1. 23 12月, 2013 5 次提交
    • J
      f2fs: introduce a bio array for per-page write bios · 1ff7bd3b
      Jaegeuk Kim 提交于
      The f2fs has three bio types, NODE, DATA, and META, and manages some data
      structures per each bio types.
      
      The codes are a little bit messy, thus, this patch introduces a bio array
      which groups individual data structures as follows.
      
      struct f2fs_bio_info {
      	struct bio *bio;		/* bios to merge */
      	sector_t last_block_in_bio;	/* last block number */
      	struct mutex io_mutex;		/* mutex for bio */
      };
      
      struct f2fs_sb_info {
      	...
      	struct f2fs_bio_info write_io[NR_PAGE_TYPE];	/* for write bios */
      	...
      };
      
      The code changes from this new data structure are trivial.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      1ff7bd3b
    • J
      f2fs: disable the extent cache ops on high fragmented files · c11abd1a
      Jaegeuk Kim 提交于
      The f2fs manages an extent cache to search a number of consecutive data blocks
      very quickly.
      
      However it conducts unnecessary cache operations if the file is highly
      fragmented with no valid extent cache.
      
      In such the case, we don't need to handle the extent cache, but just can disable
      the cache facility.
      
      Nevertheless, this patch gives one more chance to enable the extent cache.
      
      For example,
      1. create a file
      2. write data sequentially which produces a large valid extent cache
      3. update some data, resulting in a fragmented extent
      4. if the fragmented extent is too small, then drop extent cache
      5. close the file
      
      6. open the file again
      7. give another chance to make a new extent cache
      8. write data sequentially again which creates another big extent cache.
      ...
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      c11abd1a
    • J
      f2fs: use sbi->write_mutex for write bios · 971767ca
      Jaegeuk Kim 提交于
      This patch removes an unnecessary semaphore (i.e., sbi->bio_sem).
      There is no reason to use the semaphore when f2fs submits read and write IOs.
      Instead, let's use a write mutex and cover the sbi->bio[] by the lock.
      
      Change log from v1:
       o split write_mutex suggested by Chao Yu
      
      Chao described,
      "All DATA/NODE/META bio buffers in superblock is protected by
      'sbi->write_mutex', but each bio buffer area is independent, So we
      should split write_mutex to three for DATA/NODE/META."
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      971767ca
    • J
      f2fs: clean up the do_submit_bio flow · 7d5e5109
      Jaegeuk Kim 提交于
      This patch introduces PAGE_TYPE_OF_BIO() and cleans up do_submit_bio() with it.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      7d5e5109
    • J
      f2fs: add a slab cache entry for small discards · 7fd9e544
      Jaegeuk Kim 提交于
      This patch adds a slab cache entry for small discards.
      
      Each entry consists of:
      
      struct discard_entry {
      	struct list_head list;	/* list head */
      	block_t blkaddr;	/* block address to be discarded */
      	int len;		/* # of consecutive blocks of the discard */
      };
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      7fd9e544
  2. 08 11月, 2013 1 次提交
  3. 31 10月, 2013 1 次提交
  4. 29 10月, 2013 1 次提交
  5. 25 10月, 2013 4 次提交
  6. 22 10月, 2013 1 次提交
  7. 18 10月, 2013 2 次提交
    • G
      f2fs: avoid wait if IO end up when do_checkpoint for better performance · e2340887
      Gu Zheng 提交于
      Previously, do_checkpoint() will call congestion_wait() for waiting the pages
      (previous submitted node/meta/data pages) to be written back.
      Because congestion_wait() will set a regular period (e.g. HZ / 50 ) for waiting, and
      no additional wake up mechanism was introduced if IO ends up before regular period costed.
      Yuan Zhong found there is a situation that after the pages have been written back,
      but the checkpoint thread still wait for congestion_wait to exit.
      
      So here we store checkpoint task into f2fs_sb when doing checkpoint, it'll wait for IO completes
      if there's IO going on, and in the end IO path, wake up checkpoint task when IO ends up.
      
      Thanks to Yuan Zhong's pre work about this problem.
      Reported-by: NYuan Zhong <yuan.mark.zhong@samsung.com>
      Signed-off-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      e2340887
    • J
      f2fs: fix the starvation problem on cp_rwsem · b1838f89
      Jaegeuk Kim 提交于
      This patch removes the logic previously introduced to address the starvation
      on cp_rwsem.
      
      One potential there-in bug is that we should cover the wait.list with spin_lock,
      but the previous code broke this rule.
      
      And, actually current rwsem handles this starvation issue reasonably, so that we
      didn't need to do this before neither.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      b1838f89
  8. 07 10月, 2013 1 次提交
    • G
      f2fs: use rw_sem instead of fs_lock(locks mutex) · e479556b
      Gu Zheng 提交于
      The fs_locks is used to block other ops(ex, recovery) when doing checkpoint.
      And each other operate routine(besides checkpoint) needs to acquire a fs_lock,
      there is a terrible problem here, if these are too many concurrency threads acquiring
      fs_lock, so that they will block each other and may lead to some performance problem,
      but this is not the phenomenon we want to see.
      Though there are some optimization patches introduced to enhance the usage of fs_lock,
      but the thorough solution is using a *rw_sem* to replace the fs_lock.
      Checkpoint routine takes write_sem, and other ops take read_sem, so that we can block
      other ops(ex, recovery) when doing checkpoint, and other ops will not disturb each other,
      this can avoid the problem described above completely.
      Because of the weakness of rw_sem, the above change may introduce a potential problem
      that the checkpoint thread might get starved if other threads are intensively locking
      the read semaphore for I/O.(Pointed out by Xu Jin)
      In order to avoid this, a wait_list is introduced, the appending read semaphore ops
      will be dropped into the wait_list if checkpoint thread is waiting for write semaphore,
      and will be waked up when checkpoint thread gives up write semaphore.
      Thanks to Kim's previous review and test, and will be very glad to see other guys'
      performance tests about this patch.
      
      V2:
        -fix the potential starvation problem.
        -use more suitable func name suggested by Xu Jin.
      Signed-off-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
      [Jaegeuk Kim: adjust minor coding standard]
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      e479556b
  9. 24 9月, 2013 1 次提交
  10. 26 8月, 2013 4 次提交
    • J
      f2fs: support the inline xattrs · 65985d93
      Jaegeuk Kim 提交于
      0. modified inode structure
      --------------------------------------
      metadata (e.g., i_mtime, i_ctime, etc)
      --------------------------------------
      direct pointers [0 ~ 873]
      
      inline xattrs (200 bytes by default)
      
      indirect pointers [0 ~ 4]
      --------------------------------------
      node footer
      --------------------------------------
      
      1. setxattr flow
       - read_all_xattrs copies all the xattrs from inline and xattr node block.
       - handle xattr entries
       - write_all_xattrs copies modified xattrs into inline and xattr node block.
      
      2. getxattr flow
       - read_all_xattrs copies all the xattrs from inline and xattr node block.
       - check target entries
      
      3. Usage
       # mount -t f2fs -o inline_xattr $DEV $MNT
      
       Once mounted with the inline_xattr option, f2fs marks all the newly created
       files to reserve an amount of inline xattr space explicitly inside the inode
       block. Without the mount option, f2fs will not touch any existing files and
       newly created files as well.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      65985d93
    • J
      f2fs: add the truncate_xattr_node function · 4f16fb0f
      Jaegeuk Kim 提交于
      The truncate_xattr_node function will be used by inline xattr.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      4f16fb0f
    • J
      f2fs: reserve the xattr space dynamically · de93653f
      Jaegeuk Kim 提交于
      This patch enables the number of direct pointers inside on-disk inode block to
      be changed dynamically according to the size of inline xattr space.
      
      The number of direct pointers, ADDRS_PER_INODE, can be changed only if the file
      has inline xattr flag.
      
      The number of direct pointers that will be used by inline xattrs is defined as
      F2FS_INLINE_XATTR_ADDRS.
      Current patch assigns F2FS_INLINE_XATTR_ADDRS to 0 temporarily.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      de93653f
    • J
      f2fs: add flags for inline xattrs · 444c580f
      Jaegeuk Kim 提交于
      This patch adds basic inode flags for inline xattrs, F2FS_INLINE_XATTR,
      and add a mount option, inline_xattr, which is enabled when xattr is set.
      
      If the mount option is enabled, all the files are marked with the inline_xattrs
      flag.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      444c580f
  11. 09 8月, 2013 3 次提交
  12. 08 8月, 2013 1 次提交
    • J
      f2fs: fix a build failure due to missing the kobject header · c2d715d1
      Jaegeuk Kim 提交于
      This patch should resolve the following error reported by kbuild test robot.
      
      All error/warnings:
      
         In file included from fs/f2fs/dir.c:13:0:
         >> fs/f2fs/f2fs.h:435:17: error: field 's_kobj' has incomplete type
              struct kobject s_kobj;
      
      The failure was caused by missing the kobject header file in dir.c.
      So, this patch move the header file to the right location, f2fs.h.
      
      CC: Namjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      c2d715d1
  13. 06 8月, 2013 2 次提交
    • J
      f2fs: fix a deadlock in fsync · a569469e
      Jin Xu 提交于
      This patch fixes a deadlock bug that occurs quite often when there are
      concurrent write and fsync on a same file.
      
      Following is the simplified call trace when tasks get hung.
      
      fsync thread:
      - f2fs_sync_file
       ...
       - f2fs_write_data_pages
       ...
        - update_extent_cache
        ...
         - update_inode
          - wait_on_page_writeback
      
      bdi writeback thread
      - __writeback_single_inode
       - f2fs_write_data_pages
        - mutex_lock(sbi->writepages)
      
      The deadlock happens when the fsync thread waits on a inode page that has
      been added to the f2fs' cached bio sbi->bio[NODE], and unfortunately,
      no one else could be able to submit the cached bio to block layer for
      writeback. This is because the fsync thread already hold a sbi->fs_lock and
      the sbi->writepages lock, causing the bdi thread being blocked when attempt
      to write data pages for the same inode. At the same time, f2fs_gc thread
      does not notice the situation and could not help. Even the sync syscall
      gets blocked.
      
      To fix it, we could submit the cached bio first before waiting on a inode page
      that is being written back.
      Signed-off-by: NJin Xu <jinuxstyle@gmail.com>
      [Jaegeuk Kim: add more cases to use f2fs_wait_on_page_writeback]
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      a569469e
    • N
      f2fs: add sysfs support for controlling the gc_thread · b59d0bae
      Namjae Jeon 提交于
      Add sysfs entries to control the timing parameters for
      f2fs gc thread.
      
      Various Sysfs options introduced are:
      gc_min_sleep_time: Min Sleep time for GC in ms
      gc_max_sleep_time: Max Sleep time for GC in ms
      gc_no_gc_sleep_time: Default Sleep time for GC in ms
      
      Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
      Signed-off-by: NNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: NPankaj Kumar <pankaj.km@samsung.com>
      Reviewed-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
      [Jaegeuk Kim: fix an umount bug and some minor changes]
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      b59d0bae
  14. 30 7月, 2013 5 次提交
  15. 02 7月, 2013 1 次提交
  16. 14 6月, 2013 3 次提交
  17. 12 6月, 2013 1 次提交
    • J
      f2fs: sync dir->i_size with its block allocation · 699489bb
      Jaegeuk Kim 提交于
      If new dentry block is allocated and its i_size is updated, we should update
      its inode block together in order to sync i_size and its block allocation.
      Otherwise, we can loose additional dentry block due to the unconsistent i_size.
      
      Errorneous Scenario
      -------------------
      
      In the recovery routine,
       - recovery_dentry
       | - __f2fs_add_link
       | | - get_new_data_page
       | | | - i_size_write(new_i_size)
       | | | - mark_inode_dirty_sync(dir)
       | | - update_parent_metadata
       | | | - mark_inode_dirty(dir)
       |
       - write_checkpoint
         - sync_dirty_dir_inodes
           - filemap_flush(dentry_blocks)
             - f2fs_write_data_page
               - skip to write the last dentry block due to index < i_size
      
      In the above flow, new_i_size is not updated to its inode block so that the
      last dentry block will be lost accordingly.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      699489bb
  18. 11 6月, 2013 2 次提交
    • J
      f2fs: fix i_blocks translation on various types of files · 2d4d9fb5
      Jaegeuk Kim 提交于
      Basically an inode manages the number of allocated blocks with inode->i_blocks
      which is represented in a unit of sectors, not file system blocks.
      But, f2fs has used i_blocks in a unit of file system blocks, and f2fs_getattr
      translates it to the number of sectors when fstat is called.
      
      However, previously f2fs_file_inode_operations only has this, so this patch adds
      it to all the types of inode_operations.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      2d4d9fb5
    • J
      f2fs: support xattr security labels · 8ae8f162
      Jaegeuk Kim 提交于
      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: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      8ae8f162
  19. 07 6月, 2013 1 次提交
    • J
      f2fs: fix iget/iput of dir during recovery · 5deb8267
      Jaegeuk Kim 提交于
      It is possible that iput is skipped after iget during the recovery.
      
      In recover_dentry(),
       dir = f2fs_iget();
       ...
       if (de && inode->i_ino == le32_to_cpu(de->ino))
      	goto out;
      
      In this case, this dir is not able to be added in dirty_dir_inode_list.
      The actual linking is done only when set_page_dirty() is called.
      
      So let's add this newly got inode into the list explicitly, and put it at the
      end of the recovery routine.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      5deb8267