1. 09 Aug, 2013 1 commit
    • Jaegeuk Kim's avatar
      f2fs: fix inconsistency between xattr node blocks and its inode · e518ff81
      Jaegeuk Kim authored
      
      
      Previously xattr node blocks are stored to the COLD_NODE log, which means that
      our roll-forward mechanism doesn't recover the xattr node blocks at all.
      Only the direct node blocks in the WARM_NODE log can be recovered.
      
      So, let's resolve the issue simply by conducting checkpoint during fsync when a
      file has a modified xattr node block.
      
      This approach is able to degrade the performance, but normally the checkpoint
      overhead is shown at the initial fsync call after the xattr entry changes.
      Once the checkpoint is done, no additional overhead would be occurred.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      e518ff81
  2. 11 Jun, 2013 1 commit
    • Jaegeuk Kim's avatar
      f2fs: support xattr security labels · 8ae8f162
      Jaegeuk Kim authored
      This patch adds the support of security labels for f2fs, which will be used
      by Linus Security Models (LSMs).
      
      Quote from http://en.wikipedia.org/wiki/Linux_Security_Modules
      
      :
      "Linux Security Modules (LSM) is a framework that allows the Linux kernel to
      support a variety of computer security models while avoiding favoritism toward
      any single security implementation. The framework is licensed under the terms of
      the GNU General Public License and is standard part of the Linux kernel since
      Linux 2.6. AppArmor, SELinux, Smack and TOMOYO Linux are the currently accepted
      modules in the official kernel.".
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      8ae8f162
  3. 03 Jun, 2013 1 commit
  4. 09 Apr, 2013 1 commit
    • 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_GLOBAL_LOCKS]
       - f2fs_sb_info -> node_write
      
      1. mutex_lock_op(sbi)
       - try to get an avaiable lock from the array.
       - returns the index of the gottern lock variable.
      
      2. mutex_unlock_op(sbi, index of the lock)
       - unlock the given index of the lock.
      
      3. mutex_lock_all(sbi)
       - grab all the locks in the array before the checkpoint.
      
      4. mutex_unlock_all(sbi)
       - release all the locks in the array after checkpoint.
      
      5. block_operations()
       - call mutex_lock_all()
       - sync_dirty_dir_inodes()
       - grab node_write
       - sync_node_pages()
      
      Note that,
       the pairs of mutex_lock_op()/mutex_unlock_op() and
       mutex_lock_all()/mutex_unlock_all() should be used together.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      39936837
  5. 20 Mar, 2013 1 commit
  6. 11 Jan, 2013 1 commit
    • Jaegeuk Kim's avatar
      f2fs: add f2fs_balance_fs in several interfaces · 7d82db83
      Jaegeuk Kim authored
      
      
      The f2fs_balance_fs() is to check the number of free sections and decide whether
      it needs to conduct cleaning or not. If there are not enough free sections, the
      cleaning job should be started.
      
      In order to control an amount of free sections even under high utilization, f2fs
      should call f2fs_balance_fs at all the VFS interfaces that are able to produce
      dirty pages.
      This patch adds the function calls in the missing interfaces as follows.
      
      1. f2fs_setxattr()
      The f2fs_setxattr() produces dirty node pages so that we should call
      f2fs_balance_fs() either likewise doing in other VFS interfaces such as
      f2fs_lookup(), f2fs_mkdir(), and so on.
      
      2. f2fs_sync_file()
      We should guarantee serving free sections for syncing metadata during fsync.
      Previously, there is no space check before triggering checkpoint and
      sync_node_pages.
      Therefore, if a bunch of fsync calls are triggered under 100% of FS utilization,
      f2fs is able to be faced with no free sections, resulting in BUG_ON().
      
      3. f2fs_sync_fs()
      Before calling write_checkpoint(), we should guarantee that there are minimum
      free sections.
      
      4. f2fs_write_inode()
      f2fs_write_inode() is also able to produce dirty node pages.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      7d82db83
  7. 28 Dec, 2012 1 commit
  8. 11 Dec, 2012 3 commits
    • Jaegeuk Kim's avatar
      f2fs: resolve build failures · 573ea5fc
      Jaegeuk Kim authored
      
      
      There exist two build failures reported by Randy Dunlap as follows.
      
      (on i386)
       a. (config-r8857)
      	ERROR: "f2fs_xattr_advise_handler" [fs/f2fs/f2fs.ko] undefined!
      
      Key configs in (config-r8857) are as follows.
       CONFIG_F2FS_FS=m
       # CONFIG_F2FS_STAT_FS is not set
       CONFIG_F2FS_FS_XATTR=y
       # CONFIG_F2FS_FS_POSIX_ACL is not set
      
      The error was occurred due to the function location that we made a mistake.
      Recently we added a new functionality for users to indicate cold files
      explicitly through xattr operations (i.e., f2fs_xattr_advise_handler).
      
      This handler should have been added in xattr.c instead of acl.c in order
      to avoid an undefined operation like in this case where XATTR is set and
      ACL is not set.
      
       b. (config-r8855)
      	fs/f2fs/file.c: In function 'f2fs_vm_page_mkwrite':
      	fs/f2fs/file.c:97:2: error: implicit declaration of function
      	'block_page_mkwrite_return'
      
      Key config in (config-r8855) is CONFIG_BLOCK.
      
      Obviously, f2fs works on top of the block device so that we should consider
      carefully a sort of config dependencies.
      
      The reason why this error was occurred was that f2fs_vm_page_mkwrite() calls
      block_page_mkwrite_return() which is enalbed only if CONFIG_BLOCK is set.
      Reported-by: default avatarRandy Dunlap <rdunlap@xenotime.net>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      Acked-by: default avatarRandy Dunlap <rdunlap@xenotime.net>
      573ea5fc
    • Jaegeuk Kim's avatar
      f2fs: adjust kernel coding style · 0a8165d7
      Jaegeuk Kim authored
      
      
      As pointed out by Randy Dunlap, this patch removes all usage of "/**" for comment
      blocks. Instead, just use "/*".
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      0a8165d7
    • Jaegeuk Kim's avatar
      f2fs: add xattr and acl functionalities · af48b85b
      Jaegeuk Kim authored
      
      
      This implements xattr and acl functionalities.
      
      - F2FS uses a node page to contain use extended attributes.
      Signed-off-by: default avatarChangman Lee <cm224.lee@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      af48b85b