• Jaegeuk Kim's avatar
    f2fs: introduce a new global lock scheme · 39936837
    Jaegeuk Kim authored
    In the previous version, f2fs uses global locks according to the usage types,
    such as directory operations, block allocation, block write, and so on.
    
    Reference the following lock types in f2fs.h.
    enum lock_type {
    	RENAME,		/* for renaming operations */
    	DENTRY_OPS,	/* for directory operations */
    	DATA_WRITE,	/* for data write */
    	DATA_NEW,	/* for data allocation */
    	DATA_TRUNC,	/* for data truncate */
    	NODE_NEW,	/* for node allocation */
    	NODE_TRUNC,	/* for node truncate */
    	NODE_WRITE,	/* for node write */
    	NR_LOCK_TYPE,
    };
    
    In that case, we lose the performance under the multi-threading environment,
    since every types of operations must be conducted one at a time.
    
    In order to address the problem, let's share the locks globally with a mutex
    array regardless of any types.
    So, let users grab a mutex and perform their jobs in parallel as much as
    possbile.
    
    For this, I propose a new global lock scheme as follows.
    
    0. Data structure
     - f2fs_sb_info -> mutex_lock[NR_GL...
    39936837
xattr.c 10.6 KB