31 Jul, 2014

1 commit


07 Jun, 2014

1 commit

  • There is an errorneous case during the recovery like below.

    In recovery_dentry,
    1) dir = f2fs_iget();
    2) mark the dir with FI_DELAY_IPUT
    3) goto unmap_out

    After the end of recovery routine, there is no dirty dentries so the dir cannot
    be released by iput in remove_dirty_dir_inode.

    This patch fixes such the bug case by handling the iget and iput in the
    recovery_dentry procedure.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     

07 May, 2014

3 commits

  • We should set the error number correctly when we fail in recover_dentry(), so
    the recover flow could stop for the reason as error number shows instead of
    continuing.

    Signed-off-by: Chao Yu
    Signed-off-by: Jaegeuk Kim

    Chao Yu
     
  • Introduce help macro ADDRS_PER_PAGE() to get the number of address pointers in
    direct node or inode.

    Signed-off-by: Chao Yu
    Signed-off-by: Jaegeuk Kim

    Chao Yu
     
  • This patch removes list opeations in handling dirty dir inodes.
    Previously, F2FS traverses whole the list of dirty dir inodes to check whether
    there is an existing inode or not, resulting in heavy CPU overheads.

    So this patch removes such the traverse operations by adding FI_DIRTY_DIR to
    indicate the inode lies on the list or not.
    Through this simple flag, we can remove redundant operations gracefully.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     

02 Apr, 2014

1 commit


20 Mar, 2014

1 commit


10 Mar, 2014

1 commit


27 Feb, 2014

1 commit


17 Feb, 2014

3 commits

  • This patch modifies flow a little bit to avoid the following build warnings.

    src/fs/f2fs/recovery.c: In function ‘check_index_in_prev_nodes’:
    src/fs/f2fs/recovery.c:288:51: warning: ‘sum...ofs_in_node’ may
    be used uninitialized in this function [-Wmaybe-uninitialized]
    src/fs/f2fs/recovery.c:260:23: warning: ‘sum.nid’ may be used uninitialized
    in this function [-Wmaybe-uninitialized]

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • This patch adds GET_BLKOFF_FROM_SEG0 to clean up some codes.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • If a new xattr node page was allocated and its inode is fsynced, we should
    recover the xattr node page during the roll-forward process after power-cut.
    But, previously, f2fs didn't handle that case, resulting in kernel panic as
    follows reported by Tom Li.

    BUG: unable to handle kernel paging request at ffffc9001c861a98
    IP: [] check_index_in_prev_nodes+0x86/0x2d0 [f2fs]
    Call Trace:
    [] ? printk+0x48/0x4a
    [] recover_fsync_data+0xdca/0xf50 [f2fs]
    [] f2fs_fill_super+0x92e/0x970 [f2fs]
    [] mount_bdev+0x1b8/0x200
    [] ? f2fs_remount+0x130/0x130 [f2fs]
    [] f2fs_mount+0x10/0x20 [f2fs]
    [] mount_fs+0x3e/0x1b0
    [] ? __alloc_percpu+0xb/0x10
    [] vfs_kern_mount+0x6f/0x120
    [] do_mount+0x259/0xa90
    [] ? memdup_user+0x3d/0x80
    [] ? strndup_user+0x53/0x70
    [] SyS_mount+0x89/0xd0
    [] system_call_fastpath+0x16/0x1b

    This patch adds a recovery function of xattr node pages.

    Reported-by: Tom Li
    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     

20 Jan, 2014

1 commit


06 Jan, 2014

1 commit

  • This patch adds a inline_data recovery routine with the following policy.

    [prev.] [next] of inline_data flag
    o o -> recover inline_data
    o x -> remove inline_data, and then recover data blocks
    x o -> remove inline_data, and then recover inline_data
    x x -> recover data blocks

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     

26 Dec, 2013

2 commits

  • This patch introduces F2FS_INODE that returns struct f2fs_inode * from the inode
    page.
    By using this macro, we can remove unnecessary casting codes like below.

    struct f2fs_inode *ri = &F2FS_NODE(inode_page)->i;
    -> struct f2fs_inode *ri = F2FS_INODE(inode_page);

    Reviewed-by: Chao Yu
    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • In current flow, we will get Null return value of f2fs_find_entry in
    recover_dentry when name.len is bigger than F2FS_NAME_LEN, and then we
    still add this inode into its dir entry.
    To avoid this situation, we must check filename length before we use it.

    Another point is that we could remove the code of checking filename length
    In f2fs_find_entry, because f2fs_lookup will be called previously to ensure of
    validity of filename length.

    V2:
    o add WARN_ON() as Jaegeuk Kim suggested.

    Signed-off-by: Chao Yu
    Signed-off-by: Jaegeuk Kim

    Chao Yu
     

23 Dec, 2013

4 commits

  • This patch adds unlikely() macro into the most of codes.
    The basic rule is to add that when:
    - checking unusual errors,
    - checking page mappings,
    - and the other unlikely conditions.

    Change log from v1:
    - Don't add unlikely for the NULL test and error test: advised by Andi Kleen.

    Cc: Chao Yu
    Cc: Andi Kleen
    Reviewed-by: Chao Yu
    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • In find_fsync_dnodes() and recover_data(), our flow is like this:

    ->f2fs_submit_page_bio()
    -> f2fs_put_page()
    -> page_cache_release() ---- page->_count declined to zero.
    ->__free_pages()
    -> put_page_testzero() ---- page->_count will be declined again.

    We will get a segment fault in put_page_testzero when CONFIG_DEBUG_VM
    is on, or return MM with a bad page with wrong _count num.

    So let's just release this page.

    Signed-off-by: Chao Yu
    Signed-off-by: Jaegeuk Kim

    Chao Yu
     
  • Use inner macro GFP_F2FS_ZERO to instead of GFP_NOFS | __GFP_ZERO for
    simplification of code.

    Signed-off-by: Chao Yu
    Signed-off-by: Jaegeuk Kim

    Chao Yu
     
  • This patch integrates redundant bio operations on read and write IOs.

    1. Move bio-related codes to the top of data.c.
    2. Replace f2fs_submit_bio with f2fs_submit_merged_bio, which handles read
    bios additionally.
    3. Introduce __submit_merged_bio to submit the merged bio.
    4. Change f2fs_readpage to f2fs_submit_page_bio.
    5. Introduce f2fs_submit_page_mbio to integrate previous submit_read_page and
    submit_write_page.

    Reviewed-by: Gu Zheng
    Reviewed-by: Chao Yu
    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     

29 Oct, 2013

1 commit


25 Oct, 2013

1 commit


07 Oct, 2013

1 commit

  • 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: Gu Zheng
    [Jaegeuk Kim: adjust minor coding standard]
    Signed-off-by: Jaegeuk Kim

    Gu Zheng
     

25 Sep, 2013

2 commits

  • During recovery, orphan inodes are deleted via truncate_hole().
    These orphans are added by recover_dentry() via f2fs_delete_entry().
    However, f2fs_delete_entry() adds them via add_orphan_inode()
    without calling acquire_orphan_inode() first. This prevents the
    counters from being incremented properly, which causes them to
    underflow when remove_orphan_inode() is called later on.

    Signed-off-by: Russ Knize
    Signed-off-by: Jaegeuk Kim

    Russ W. Knize
     
  • Previously, recover_fsync_data still to write checkpoint when there is
    nothing to recover with normal umount image.
    It may reduce mount performance and flash memory lifetime, so let's remove
    it.

    Signed-off-by: Tan Shu
    Signed-off-by: Yu Chao
    Reviewed-by: Gu Zheng
    Signed-off-by: Jaegeuk Kim

    Chao Yu
     

26 Aug, 2013

1 commit

  • 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: Jaegeuk Kim

    Jaegeuk Kim
     

19 Aug, 2013

1 commit


09 Aug, 2013

1 commit


30 Jul, 2013

1 commit


02 Jul, 2013

2 commits

  • As destroy_fsync_dnodes() is a simple list-cleanup func, so delete the unused
    and unrelated f2fs_sb_info argument of it.

    Signed-off-by: Gu Zheng
    Signed-off-by: Jaegeuk Kim

    Gu Zheng
     
  • This patch should fix the following bug reported by kbuild test robot.

    fs/f2fs/recovery.c:233:33: sparse: incorrect type in assignment
    (different base types)

    parse warnings: (new ones prefixed by >>)

    >> recovery.c:233: sparse: incorrect type in assignment (different base types)
    recovery.c:233: expected unsigned int [unsigned] [assigned] ofs_in_node
    recovery.c:233: got restricted __le16 [assigned] [usertype] ofs_in_node
    >> recovery.c:238: sparse: incorrect type in assignment (different base types)
    recovery.c:238: expected unsigned int [unsigned] ofs_in_node
    recovery.c:238: got restricted __le16 [assigned] [usertype] ofs_in_node

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     

07 Jun, 2013

1 commit

  • 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: Jaegeuk Kim

    Jaegeuk Kim
     

28 May, 2013

8 commits

  • The error scenario is:
    1. create /a
    (1.a link /a /b)
    2. sync
    3. unlinke /a
    4. create /a
    5. fsync /a
    6. Sudden power-off

    When the f2fs recovers the fsynced dentry, /a, we discover an exsiting dentry at
    f2fs_find_entry() in recover_dentry().

    In such the case, we should unlink the existing dentry and its inode
    and then recover newly created dentry.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • There is an error path where "dir" is an ERR_PTR.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Jaegeuk Kim

    Dan Carpenter
     
  • This patch adds error handling codes of check_index_in_prev_nodes and its
    caller, do_recover_data.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • This patch fixes the following deadlock bug during the recovery.

    INFO: task mount:1322 blocked for more than 120 seconds.
    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    mount D ffffffff81125870 0 1322 1266 0x00000000
    ffff8801207e39d8 0000000000000046 ffff88012ab1dee0 0000000000000046
    ffff8801207e3a08 ffff880115903f40 ffff8801207e3fd8 ffff8801207e3fd8
    ffff8801207e3fd8 ffff880115903f40 ffff8801207e39d8 ffff88012fc94520
    Call Trace:
    [] ? __lock_page+0x70/0x70
    [] schedule+0x29/0x70
    [] io_schedule+0x8f/0xd0
    [] sleep_on_page+0xe/0x20
    [] __wait_on_bit_lock+0x5a/0xc0
    [] __lock_page+0x67/0x70
    [] ? autoremove_wake_function+0x40/0x40
    [] find_lock_page+0x67/0x80
    [] find_or_create_page+0x3f/0xb0
    [] ? sync_inode_page+0xa8/0xd0 [f2fs]
    [] get_node_page+0x67/0x180 [f2fs]
    [] recover_fsync_data+0xacb/0xff0 [f2fs]
    [] ? _raw_spin_unlock+0x3e/0x40
    [] f2fs_fill_super+0x7d4/0x850 [f2fs]
    [] mount_bdev+0x1c9/0x210
    [] ? validate_superblock+0x180/0x180 [f2fs]
    [] f2fs_mount+0x15/0x20 [f2fs]
    [] mount_fs+0x43/0x1b0
    [] ? __alloc_percpu+0x10/0x20
    [] vfs_kern_mount+0x76/0x120
    [] do_mount+0x237/0xa10
    [] ? strndup_user+0x5b/0x80
    [] SyS_mount+0x90/0xe0
    [] system_call_fastpath+0x16/0x1b

    The bug is triggered when check_index_in_prev_nodes tries to get the direct
    node page by calling get_node_page.
    At this point, if the direct node page is already locked by get_dnode_of_data,
    its caller, we got a deadlock condition.

    This patch adds additional condition check for the reuse of locked direct node
    pages prior to the get_node_page call.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • If we met an error during the dentry recovery, we should not conduct checkpoint.
    Otherwise, some errorneous dentry blocks overwrites the existing blocks that
    contain the remaining recovery information.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • If we got an error after lock_page, we should unlock it before exit.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • The allocated page used by the recovery is not on HIGHMEM, so that we don't
    need to use kmap/kunmap.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • This patch adds some trivial debugging messages in the recovery process.

    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim