1. 01 6月, 2018 12 次提交
    • C
      f2fs: make __f2fs_write_data_pages() static · fc99fe27
      Chao Yu 提交于
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      fc99fe27
    • C
      f2fs: fix to let caller retry allocating block address · fe16efe6
      Chao Yu 提交于
      Configure io_bits with 2 and enable LFS mode, generic/013 reports below dmesg:
      
      BUG: unable to handle kernel NULL pointer dereference at 00000104
      *pdpt = 0000000029b7b001 *pde = 0000000000000000
      Oops: 0002 [#1] PREEMPT SMP
      Modules linked in: crc32_generic zram f2fs(O) rfcomm bnep bluetooth ecdh_generic snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq pcbc joydev snd_seq_device aesni_intel snd_timer aes_i586 snd crypto_simd cryptd soundcore i2c_piix4 serio_raw mac_hid video parport_pc ppdev lp parport hid_generic psmouse usbhid hid e1000
      CPU: 0 PID: 11161 Comm: fsstress Tainted: G           O      4.17.0-rc2 #38
      Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
      EIP: f2fs_submit_page_write+0x28d/0x550 [f2fs]
      EFLAGS: 00010206 CPU: 0
      EAX: e863dcd8 EBX: 00000000 ECX: 00000100 EDX: 00000200
      ESI: e863dcf4 EDI: f6f82768 EBP: e863dbb0 ESP: e863db74
       DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      CR0: 80050033 CR2: 00000104 CR3: 29a62020 CR4: 000406f0
      Call Trace:
       do_write_page+0x6f/0xc0 [f2fs]
       write_data_page+0x4a/0xd0 [f2fs]
       do_write_data_page+0x327/0x630 [f2fs]
       __write_data_page+0x34b/0x820 [f2fs]
       __f2fs_write_data_pages+0x42d/0x8c0 [f2fs]
       f2fs_write_data_pages+0x27/0x30 [f2fs]
       do_writepages+0x1a/0x70
       __filemap_fdatawrite_range+0x94/0xd0
       filemap_write_and_wait_range+0x3d/0xa0
       __generic_file_write_iter+0x11a/0x1f0
       f2fs_file_write_iter+0xdd/0x3b0 [f2fs]
       __vfs_write+0xd2/0x150
       vfs_write+0x9b/0x190
       ksys_write+0x45/0x90
       sys_write+0x16/0x20
       do_fast_syscall_32+0xaa/0x22c
       entry_SYSENTER_32+0x4c/0x7b
      EIP: 0xb7fc8c51
      EFLAGS: 00000246 CPU: 0
      EAX: ffffffda EBX: 00000003 ECX: 09cde000 EDX: 00001000
      ESI: 00000003 EDI: 00001000 EBP: 00000000 ESP: bfbded38
       DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b
      Code: e8 f9 77 34 c9 8b 45 e0 8b 80 b8 00 00 00 39 45 d8 0f 84 bb 02 00 00 8b 45 e0 8b 80 b8 00 00 00 8d 50 d8 8b 08 89 55 f0 8b 50 04 <89> 51 04 89 0a c7 00 00 01 00 00 c7 40 04 00 02 00 00 8b 45 dc
      EIP: f2fs_submit_page_write+0x28d/0x550 [f2fs] SS:ESP: 0068:e863db74
      CR2: 0000000000000104
      ---[ end trace 4cac79c0d1305ee6 ]---
      
      allocate_data_block will submit all sequential pending IOs sorted by a
      FIFO list, If we failed to submit other user's IO due to unaligned write,
      we will retry to allocate new block address for current IO, then it will
      initialize fio.list again, if fio was in the list before, it can break
      FIFO list, result in above panic.
      
      Thread A			Thread B
      - do_write_page
       - allocate_data_block
        - list_add_tail
        : fioA cached in FIFO list.
      				- do_write_page
      				 - allocate_data_block
      				  - list_add_tail
      				  : fioB cached in FIFO list.
      				 - f2fs_submit_page_write
      				 : fail to submit IO
      				 - allocate_data_block
      				  - INIT_LIST_HEAD
       - f2fs_submit_page_write
        - list_del  <-- NULL pointer dereference
      
      This patch adds fio.retry parameter to indicate failure status for each
      IO, and avoid bailing out if there is still pending IO in FIFO list for
      fixing.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      fe16efe6
    • C
      f2fs: clean up with clear_radix_tree_dirty_tag · aec2f729
      Chao Yu 提交于
      Introduce clear_radix_tree_dirty_tag to include common codes for cleanup.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      aec2f729
    • Y
      f2fs: let discard thread wait a little longer if dev is busy · f9d1dced
      Yunlei He 提交于
      This patch modify discard thread wait policy as below:
      	issued       io_interrupted     wait time(ms)
      1.        8                 0               50
      2.      (0,8)               1               50
      3.        0                 1              500 (dev is busy)
      4.        0                 0            60000 (no candidates)
      Signed-off-by: NYunlei He <heyunlei@huawei.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      f9d1dced
    • C
      f2fs: avoid stucking GC due to atomic write · 2ef79ecb
      Chao Yu 提交于
      f2fs doesn't allow abuse on atomic write class interface, so except
      limiting in-mem pages' total memory usage capacity, we need to limit
      atomic-write usage as well when filesystem is seriously fragmented,
      otherwise we may run into infinite loop during foreground GC because
      target blocks in victim segment are belong to atomic opened file for
      long time.
      
      Now, we will detect failure due to atomic write in foreground GC, if
      the count exceeds threshold, we will drop all atomic written data in
      cache, by this, I expect it can keep our system running safely to
      prevent Dos attack.
      
      In addition, his patch adds to show GC skip information in debugfs,
      now it just shows count of skipped caused by atomic write.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      2ef79ecb
    • J
      f2fs: introduce sbi->gc_mode to determine the policy · 5b0e9539
      Jaegeuk Kim 提交于
      This is to avoid sbi->gc_thread pointer access.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      5b0e9539
    • C
      f2fs: keep migration IO order in LFS mode · 107a805d
      Chao Yu 提交于
      For non-migration IO, we will keep order of data/node blocks' submitting
      as allocation sequence by sorting IOs in per log io_list list, but for
      migration IO, it could be out-of-order.
      
      In LFS mode, we should keep all IOs including migration IO be ordered,
      so that this patch fixes to add an additional lock to keep submitting
      order.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      107a805d
    • C
      f2fs: clean up with is_valid_blkaddr() · 7b525dd0
      Chao Yu 提交于
      - rename is_valid_blkaddr() to is_valid_meta_blkaddr() for readability.
      - introduce is_valid_blkaddr() for cleanup.
      
      No logic change in this patch.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      7b525dd0
    • C
      Revert "f2fs: add ovp valid_blocks check for bg gc victim to fg_gc" · 299254d8
      Chao Yu 提交于
      For extreme case:
      10 section, op = 10%, no_fggc_threshold = 90%
      All section usage: 85% 85% 85% 85% 90% 90% 95% 95% 95% 95%
      
      During foreground GC, if we skip select dirty section whose usage
      is larger than no_fggc_threshold, we can only recycle 80% invalid
      space from four 85% usage sections and two 90% usage sections,
      result in encountering out-of-space issue.
      
      This reverts commit e93b9865 to
      fix this issue, besides, we keep the logic that we scan all dirty
      section when searching a victim, so that GC can select victim with
      least valid blocks.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      299254d8
    • C
      f2fs: rename dio_rwsem to i_gc_rwsem · b2532c69
      Chao Yu 提交于
      RW semphore dio_rwsem in struct f2fs_inode_info is introduced to avoid
      race between dio and data gc, but now, it is more wildly used to avoid
      foreground operation vs data gc. So rename it to i_gc_rwsem to improve
      its readability.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      b2532c69
    • J
      f2fs: give message and set need_fsck given broken node id · a4f843bd
      Jaegeuk Kim 提交于
      syzbot hit the following crash on upstream commit
      83beed7b (Fri Apr 20 17:56:32 2018 +0000)
      Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
      syzbot dashboard link: https://syzkaller.appspot.com/bug?extid=d154ec99402c6f628887
      
      C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5414336294027264
      syzkaller reproducer: https://syzkaller.appspot.com/x/repro.syz?id=5471683234234368
      Raw console output: https://syzkaller.appspot.com/x/log.txt?id=5436660795834368
      Kernel config: https://syzkaller.appspot.com/x/.config?id=1808800213120130118
      compiler: gcc (GCC) 8.0.1 20180413 (experimental)
      
      IMPORTANT: if you fix the bug, please add the following tag to the commit:
      Reported-by: syzbot+d154ec99402c6f628887@syzkaller.appspotmail.com
      It will help syzbot understand when the bug is fixed. See footer for details.
      If you forward the report, please keep this part and the footer.
      
      F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
      F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
      F2FS-fs (loop0): invalid crc value
      ------------[ cut here ]------------
      kernel BUG at fs/f2fs/node.c:1185!
      invalid opcode: 0000 [#1] SMP KASAN
      Dumping ftrace buffer:
         (ftrace buffer empty)
      Modules linked in:
      CPU: 1 PID: 4549 Comm: syzkaller704305 Not tainted 4.17.0-rc1+ #10
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:__get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185
      RSP: 0018:ffff8801d960e820 EFLAGS: 00010293
      RAX: ffff8801d88205c0 RBX: 0000000000000003 RCX: ffffffff82f6cc06
      RDX: 0000000000000000 RSI: ffffffff82f6d5e8 RDI: 0000000000000004
      RBP: ffff8801d960ec30 R08: ffff8801d88205c0 R09: ffffed003b5e46c2
      R10: 0000000000000003 R11: 0000000000000003 R12: ffff8801a86e00c0
      R13: 0000000000000001 R14: ffff8801a86e0530 R15: ffff8801d9745240
      FS:  000000000072c880(0000) GS:ffff8801daf00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f3d403209b8 CR3: 00000001d8f3f000 CR4: 00000000001406e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       get_node_page fs/f2fs/node.c:1237 [inline]
       truncate_xattr_node+0x152/0x2e0 fs/f2fs/node.c:1014
       remove_inode_page+0x200/0xaf0 fs/f2fs/node.c:1039
       f2fs_evict_inode+0xe86/0x1710 fs/f2fs/inode.c:547
       evict+0x4a6/0x960 fs/inode.c:557
       iput_final fs/inode.c:1519 [inline]
       iput+0x62d/0xa80 fs/inode.c:1545
       f2fs_fill_super+0x5f4e/0x7bf0 fs/f2fs/super.c:2849
       mount_bdev+0x30c/0x3e0 fs/super.c:1164
       f2fs_mount+0x34/0x40 fs/f2fs/super.c:3020
       mount_fs+0xae/0x328 fs/super.c:1267
       vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
       vfs_kern_mount fs/namespace.c:1027 [inline]
       do_new_mount fs/namespace.c:2518 [inline]
       do_mount+0x564/0x3070 fs/namespace.c:2848
       ksys_mount+0x12d/0x140 fs/namespace.c:3064
       __do_sys_mount fs/namespace.c:3078 [inline]
       __se_sys_mount fs/namespace.c:3075 [inline]
       __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
       do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x443dea
      RSP: 002b:00007ffcc7882368 EFLAGS: 00000297 ORIG_RAX: 00000000000000a5
      RAX: ffffffffffffffda RBX: 0000000020000c00 RCX: 0000000000443dea
      RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffcc7882370
      RBP: 0000000000000003 R08: 0000000020016a00 R09: 000000000000000a
      R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000004
      R13: 0000000000402ce0 R14: 0000000000000000 R15: 0000000000000000
      RIP: __get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185 RSP: ffff8801d960e820
      ---[ end trace 4edbeb71f002bb76 ]---
      
      Reported-and-tested-by: syzbot+d154ec99402c6f628887@syzkaller.appspotmail.com
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      a4f843bd
    • C
      f2fs: introduce private inode status mapping · 59c84408
      Chao Yu 提交于
      Previously, we use generic FS_*_FL defined by vfs to indicate inode status
      for each bit of i_flags, so f2fs's flag status definition is tied to vfs'
      one, it will be hard for f2fs to reuse bits f2fs never used to indicate
      new status..
      
      In order to solve this issue, we introduce private inode status mapping,
      Note, for these bits have already been persisted into disk, we should
      never change their definition, for other ones, we can remap them for
      later new coming status.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      59c84408
  2. 30 5月, 2018 4 次提交
  3. 03 5月, 2018 3 次提交
    • J
      f2fs: check cap_resource only for data blocks · a90a0884
      Jaegeuk Kim 提交于
      This patch changes the rule to check cap_resource for data blocks, not inode
      or node blocks in order to avoid selinux denial.
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      a90a0884
    • J
      Revert "f2fs: introduce f2fs_set_page_dirty_nobuffer" · b87078ad
      Jaegeuk Kim 提交于
      This patch reverts copied f2fs_set_page_dirty_nobuffer to use generic function
      for stability.
      
      This reverts commit fe76b796.
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      b87078ad
    • E
      f2fs: refactor read path to allow multiple postprocessing steps · 6dbb1796
      Eric Biggers 提交于
      Currently f2fs's ->readpage() and ->readpages() assume that either the
      data undergoes no postprocessing, or decryption only.  But with
      fs-verity, there will be an additional authenticity verification step,
      and it may be needed either by itself, or combined with decryption.
      
      To support this, store a 'struct bio_post_read_ctx' in ->bi_private
      which contains a work struct, a bitmask of postprocessing steps that are
      enabled, and an indicator of the current step.  The bio completion
      routine, if there was no I/O error, enqueues the first postprocessing
      step.  When that completes, it continues to the next step.  Pages that
      fail any postprocessing step have PageError set.  Once all steps have
      completed, pages without PageError set are set Uptodate, and all pages
      are unlocked.
      
      Also replace f2fs_encrypted_file() with a new function
      f2fs_post_read_required() in places like direct I/O and garbage
      collection that really should be testing whether the file needs special
      I/O processing, not whether it is encrypted specifically.
      
      This may also be useful for other future f2fs features such as
      compression.
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      6dbb1796
  4. 04 4月, 2018 1 次提交
  5. 03 4月, 2018 2 次提交
  6. 29 3月, 2018 1 次提交
    • E
      f2fs: reserve bits for fs-verity · 53fedcc0
      Eric Biggers 提交于
      Reserve an F2FS feature flag and inode flag for fs-verity.  This is an
      in-development feature that is planned be discussed at LSF/MM 2018 [1].
      It will provide file-based integrity and authenticity for read-only
      files.  Most code will be in a filesystem-independent module, with
      smaller changes needed to individual filesystems that opt-in to
      supporting the feature.  An early prototype supporting F2FS is available
      [2].  Reserving the F2FS on-disk bits for fs-verity will prevent users
      of the prototype from conflicting with other new F2FS features.
      
      Note that we're reserving the inode flag in f2fs_inode.i_advise, which
      isn't really appropriate since it's not a hint or advice.  But
      ->i_advise is already being used to hold the 'encrypt' flag; and F2FS's
      ->i_flags uses the generic FS_* values, so it seems ->i_flags can't be
      used for an F2FS-specific flag without additional work to remove the
      assumption that ->i_flags uses the generic flags namespace.
      
      [1] https://marc.info/?l=linux-fsdevel&m=151690752225644
      [2] https://git.kernel.org/pub/scm/linux/kernel/git/mhalcrow/linux.git/log/?h=fs-verity-devSigned-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      53fedcc0
  7. 19 3月, 2018 1 次提交
  8. 17 3月, 2018 8 次提交
  9. 13 3月, 2018 8 次提交
    • C
      f2fs: support hot file extension · b6a06cbb
      Chao Yu 提交于
      This patch supports to recognize hot file extension in f2fs, so that we
      can allocate proper hot segment location for its data, which can lead to
      better hot/cold seperation in filesystem.
      
      In addition, we changes a bit on query/add/del operation method for
      extension_list sysfs entry as below:
      
      - Query: cat /sys/fs/f2fs/<disk>/extension_list
      - Add: echo 'extension' > /sys/fs/f2fs/<disk>/extension_list
      - Del: echo '!extension' > /sys/fs/f2fs/<disk>/extension_list
      - Add: echo '[h/c]extension' > /sys/fs/f2fs/<disk>/extension_list
      - Del: echo '[h/c]!extension' > /sys/fs/f2fs/<disk>/extension_list
      - [h] means add/del hot file extension
      - [c] means add/del cold file extension
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      b6a06cbb
    • J
      f2fs: add mount option for segment allocation policy · 07939627
      Jaegeuk Kim 提交于
      This patch adds an mount option, "alloc_mode=%s" having two options, "default"
      and "reuse".
      
      In "alloc_mode=reuse" case, f2fs starts to allocate segments from 0'th segment
      all the time to reassign segments. It'd be useful for small-sized eMMC parts.
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      07939627
    • C
      f2fs: expose extension_list sysfs entry · 846ae671
      Chao Yu 提交于
      This patch adds a sysfs entry 'extension_list' to support
      query/add/del item in extension list.
      
      Query:
      cat /sys/fs/f2fs/<device>/extension_list
      
      Add:
      echo 'extension' > /sys/fs/f2fs/<device>/extension_list
      
      Del:
      echo '!extension' > /sys/fs/f2fs/<device>/extension_list
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      846ae671
    • C
      f2fs: introduce sb_lock to make encrypt pwsalt update exclusive · d0d3f1b3
      Chao Yu 提交于
      f2fs_super_block.encrypt_pw_salt can be udpated and persisted
      concurrently, result in getting different pwsalt in separated
      threads, so let's introduce sb_lock to exclude concurrent
      accessers.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      d0d3f1b3
    • S
      f2fs: clean up f2fs_sb_has_xxx functions · ccd31cb2
      Sheng Yong 提交于
      This patch introduces F2FS_FEATURE_FUNCS to clean up the definitions of
      different f2fs_sb_has_xxx functions.
      Signed-off-by: NSheng Yong <shengyong1@huawei.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      ccd31cb2
    • H
      f2fs: support passing down write hints to block layer with F2FS policy · f2e703f9
      Hyunchul Lee 提交于
      Add 'whint_mode=fs-based' mount option. In this mode, F2FS passes
      down write hints with its policy.
      
      * whint_mode=fs-based. F2FS passes down hints with its policy.
      
      User                  F2FS                     Block
      ----                  ----                     -----
                            META                     WRITE_LIFE_MEDIUM;
                            HOT_NODE                 WRITE_LIFE_NOT_SET
                            WARM_NODE                "
                            COLD_NODE                WRITE_LIFE_NONE
      ioctl(COLD)           COLD_DATA                WRITE_LIFE_EXTREME
      extension list        "                        "
      
      -- buffered io
      WRITE_LIFE_EXTREME    COLD_DATA                WRITE_LIFE_EXTREME
      WRITE_LIFE_SHORT      HOT_DATA                 WRITE_LIFE_SHORT
      WRITE_LIFE_NOT_SET    WARM_DATA                WRITE_LIFE_LONG
      WRITE_LIFE_NONE       "                        "
      WRITE_LIFE_MEDIUM     "                        "
      WRITE_LIFE_LONG       "                        "
      
      -- direct io
      WRITE_LIFE_EXTREME    COLD_DATA                WRITE_LIFE_EXTREME
      WRITE_LIFE_SHORT      HOT_DATA                 WRITE_LIFE_SHORT
      WRITE_LIFE_NOT_SET    WARM_DATA                WRITE_LIFE_NOT_SET
      WRITE_LIFE_NONE       "                        WRITE_LIFE_NONE
      WRITE_LIFE_MEDIUM     "                        WRITE_LIFE_MEDIUM
      WRITE_LIFE_LONG       "                        WRITE_LIFE_LONG
      
      Many thanks to Chao Yu and Jaegeuk Kim for comments to
      implement this patch.
      Signed-off-by: NHyunchul Lee <cheol.lee@lge.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      f2e703f9
    • H
      f2fs: support passing down write hints given by users to block layer · 0cdd3195
      Hyunchul Lee 提交于
      Add the 'whint_mode' mount option that controls which write
      hints are passed down to block layer. There are "off" and
      "user-based" mode. The default mode is "off".
      
      1) whint_mode=off. F2FS only passes down WRITE_LIFE_NOT_SET.
      
      2) whint_mode=user-based. F2FS tries to pass down hints given
      by users.
      
      User                  F2FS                     Block
      ----                  ----                     -----
                            META                     WRITE_LIFE_NOT_SET
                            HOT_NODE                 "
                            WARM_NODE                "
                            COLD_NODE                "
      ioctl(COLD)           COLD_DATA                WRITE_LIFE_EXTREME
      extension list        "                        "
      
      -- buffered io
      WRITE_LIFE_EXTREME    COLD_DATA                WRITE_LIFE_EXTREME
      WRITE_LIFE_SHORT      HOT_DATA                 WRITE_LIFE_SHORT
      WRITE_LIFE_NOT_SET    WARM_DATA                WRITE_LIFE_NOT_SET
      WRITE_LIFE_NONE       "                        "
      WRITE_LIFE_MEDIUM     "                        "
      WRITE_LIFE_LONG       "                        "
      
      -- direct io
      WRITE_LIFE_EXTREME    COLD_DATA                WRITE_LIFE_EXTREME
      WRITE_LIFE_SHORT      HOT_DATA                 WRITE_LIFE_SHORT
      WRITE_LIFE_NOT_SET    WARM_DATA                WRITE_LIFE_NOT_SET
      WRITE_LIFE_NONE       "                        WRITE_LIFE_NONE
      WRITE_LIFE_MEDIUM     "                        WRITE_LIFE_MEDIUM
      WRITE_LIFE_LONG       "                        WRITE_LIFE_LONG
      
      Many thanks to Chao Yu and Jaegeuk Kim for comments to
      implement this patch.
      Signed-off-by: NHyunchul Lee <cheol.lee@lge.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      [Jaegeuk Kim: avoid build warning]
      [Chao Yu: fix to restore whint_mode in ->remount_fs]
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0cdd3195
    • C
      f2fs: support large nat bitmap · 199bc3fe
      Chao Yu 提交于
      Previously, we will store all nat version bitmap in checkpoint pack block,
      so our total node entry number has a limitation which caused total node
      number can not exceed (3900 * 8) block * 455 node/block = 14196000. So
      that once user wants to create more nodes in large size image, it becomes
      a bottleneck, that's unreasonable.
      
      This patch detects the new layout of nat/sit version bitmap in image in
      order to enable supporting large nat bitmap.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      199bc3fe