1. 01 9月, 2021 1 次提交
  2. 31 8月, 2021 1 次提交
    • C
      f2fs: fix unexpected ENOENT comes from f2fs_map_blocks() · adf9ea89
      Chao Yu 提交于
      In below path, it will return ENOENT if filesystem is shutdown:
      
      - f2fs_map_blocks
       - f2fs_get_dnode_of_data
        - f2fs_get_node_page
         - __get_node_page
          - read_node_page
           - is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN)
             return -ENOENT
       - force return value from ENOENT to 0
      
      It should be fine for read case, since it indicates a hole condition,
      and caller could use .m_next_pgofs to skip the hole and continue the
      lookup.
      
      However it may cause confusing for write case, since leaving a hole
      there, and said nothing was wrong doesn't help.
      
      There is at least one case from dax_iomap_actor() will complain that,
      so fix this in prior to supporting dax in f2fs.
      
      xfstest generic/388 reports below warning:
      
      ubuntu godown: xfstests-induced forced shutdown of /mnt/scratch_f2fs:
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 485833 at fs/dax.c:1127 dax_iomap_actor+0x339/0x370
      Call Trace:
       iomap_apply+0x1c4/0x7b0
       ? dax_iomap_rw+0x1c0/0x1c0
       dax_iomap_rw+0xad/0x1c0
       ? dax_iomap_rw+0x1c0/0x1c0
       f2fs_file_write_iter+0x5ab/0x970 [f2fs]
       do_iter_readv_writev+0x273/0x2e0
       do_iter_write+0xab/0x1f0
       vfs_iter_write+0x21/0x40
       iter_file_splice_write+0x287/0x540
       do_splice+0x37c/0xa60
       __x64_sys_splice+0x15f/0x3a0
       do_syscall_64+0x3b/0x90
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      ubuntu godown: xfstests-induced forced shutdown of /mnt/scratch_f2fs:
      ------------[ cut here ]------------
      RIP: 0010:dax_iomap_pte_fault.isra.0+0x72e/0x14a0
      Call Trace:
       dax_iomap_fault+0x44/0x70
       f2fs_dax_huge_fault+0x155/0x400 [f2fs]
       f2fs_dax_fault+0x18/0x30 [f2fs]
       __do_fault+0x4e/0x120
       do_fault+0x3cf/0x7a0
       __handle_mm_fault+0xa8c/0xf20
       ? find_held_lock+0x39/0xd0
       handle_mm_fault+0x1b6/0x480
       do_user_addr_fault+0x320/0xcd0
       ? rcu_read_lock_sched_held+0x67/0xc0
       exc_page_fault+0x77/0x3f0
       ? asm_exc_page_fault+0x8/0x30
       asm_exc_page_fault+0x1e/0x30
      
      Fixes: 83a3bfdb ("f2fs: indicate shutdown f2fs to allow unmount successfully")
      Signed-off-by: NChao Yu <chao@kernel.org>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      adf9ea89
  3. 24 8月, 2021 2 次提交
    • D
      f2fs: introduce periodic iostat io latency traces · a4b68176
      Daeho Jeong 提交于
      Whenever we notice some sluggish issues on our machines, we are always
      curious about how well all types of I/O in the f2fs filesystem are
      handled. But, it's hard to get this kind of real data. First of all,
      we need to reproduce the issue while turning on the profiling tool like
      blktrace, but the issue doesn't happen again easily. Second, with the
      intervention of any tools, the overall timing of the issue will be
      slightly changed and it sometimes makes us hard to figure it out.
      
      So, I added the feature printing out IO latency statistics tracepoint
      events, which are minimal things to understand filesystem's I/O related
      behaviors, into F2FS_IOSTAT kernel config. With "iostat_enable" sysfs
      node on, we can get this statistics info in a periodic way and it
      would cause the least overhead.
      
      [samples]
       f2fs_ckpt-254:1-507     [003] ....  2842.439683: f2fs_iostat_latency:
      dev = (254,11), iotype [peak lat.(ms)/avg lat.(ms)/count],
      rd_data [136/1/801], rd_node [136/1/1704], rd_meta [4/2/4],
      wr_sync_data [164/16/3331], wr_sync_node [152/3/648],
      wr_sync_meta [160/2/4243], wr_async_data [24/13/15],
      wr_async_node [0/0/0], wr_async_meta [0/0/0]
      
       f2fs_ckpt-254:1-507     [002] ....  2845.450514: f2fs_iostat_latency:
      dev = (254,11), iotype [peak lat.(ms)/avg lat.(ms)/count],
      rd_data [60/3/456], rd_node [60/3/1258], rd_meta [0/0/1],
      wr_sync_data [120/12/2285], wr_sync_node [88/5/428],
      wr_sync_meta [52/6/2990], wr_async_data [4/1/3],
      wr_async_node [0/0/0], wr_async_meta [0/0/0]
      Signed-off-by: NDaeho Jeong <daehojeong@google.com>
      Reviewed-by: NChao Yu <chao@kernel.org>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      a4b68176
    • D
      f2fs: separate out iostat feature · 52118743
      Daeho Jeong 提交于
      Added F2FS_IOSTAT config option to support getting IO statistics through
      sysfs and printing out periodic IO statistics tracepoint events and
      moved I/O statistics related codes into separate files for better
      maintenance.
      Signed-off-by: NDaeho Jeong <daehojeong@google.com>
      Reviewed-by: NChao Yu <chao@kernel.org>
      [Jaegeuk Kim: set default=y]
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      52118743
  4. 18 8月, 2021 2 次提交
  5. 13 8月, 2021 1 次提交
  6. 06 8月, 2021 1 次提交
    • C
      f2fs: extent cache: support unaligned extent · 94afd6d6
      Chao Yu 提交于
      Compressed inode may suffer read performance issue due to it can not
      use extent cache, so I propose to add this unaligned extent support
      to improve it.
      
      Currently, it only works in readonly format f2fs image.
      
      Unaligned extent: in one compressed cluster, physical block number
      will be less than logical block number, so we add an extra physical
      block length in extent info in order to indicate such extent status.
      
      The idea is if one whole cluster blocks are contiguous physically,
      once its mapping info was readed at first time, we will cache an
      unaligned (or aligned) extent info entry in extent cache, it expects
      that the mapping info will be hitted when rereading cluster.
      
      Merge policy:
      - Aligned extents can be merged.
      - Aligned extent and unaligned extent can not be merged.
      Signed-off-by: NChao Yu <chao@kernel.org>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      94afd6d6
  7. 03 8月, 2021 3 次提交
  8. 25 7月, 2021 2 次提交
  9. 20 7月, 2021 1 次提交
  10. 13 7月, 2021 1 次提交
    • J
      f2fs: Convert to using invalidate_lock · edc6d01b
      Jan Kara 提交于
      Use invalidate_lock instead of f2fs' private i_mmap_sem. The intended
      purpose is exactly the same. By this conversion we fix a long standing
      race between hole punching and read(2) / readahead(2) paths that can
      lead to stale page cache contents.
      
      CC: Jaegeuk Kim <jaegeuk@kernel.org>
      CC: Chao Yu <yuchao0@huawei.com>
      CC: linux-f2fs-devel@lists.sourceforge.net
      Acked-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      edc6d01b
  11. 06 7月, 2021 1 次提交
  12. 23 6月, 2021 4 次提交
    • C
      f2fs: swap: support migrating swapfile in aligned write mode · 859fca6b
      Chao Yu 提交于
      This patch supports to migrate swapfile in aligned write mode during
      swapon in order to keep swapfile being aligned to section as much as
      possible, then pinned swapfile will locates fully filled section which
      may not affected by GC.
      
      However, for the case that swapfile's size is not aligned to section
      size, it will still leave last extent in file's tail as unaligned due
      to its size is smaller than section size, like case #2.
      
      case #1
      xfs_io -f /mnt/f2fs/file -c "pwrite 0 4M" -c "fsync"
      
      Before swapon:
       EXT: FILE-OFFSET      BLOCK-RANGE      TOTAL FLAGS
         0: [0..3047]:       1123352..1126399  3048 0x1000
         1: [3048..7143]:    237568..241663    4096 0x1000
         2: [7144..8191]:    245760..246807    1048 0x1001
      After swapon:
       EXT: FILE-OFFSET      BLOCK-RANGE      TOTAL FLAGS
         0: [0..8191]:       249856..258047    8192 0x1001
      Kmsg:
      F2FS-fs (zram0): Swapfile (2) is not align to section:
      1) creat(), 2) ioctl(F2FS_IOC_SET_PIN_FILE), 3) fallocate(2097152 * n)
      
      case #2
      xfs_io -f /mnt/f2fs/file -c "pwrite 0 3M" -c "fsync"
      
      Before swapon:
       EXT: FILE-OFFSET      BLOCK-RANGE      TOTAL FLAGS
         0: [0..3047]:       246808..249855    3048 0x1000
         1: [3048..6143]:    237568..240663    3096 0x1001
      After swapon:
       EXT: FILE-OFFSET      BLOCK-RANGE      TOTAL FLAGS
         0: [0..4095]:       258048..262143    4096 0x1000
         1: [4096..6143]:    238616..240663    2048 0x1001
      Kmsg:
      F2FS-fs (zram0): Swapfile: last extent is not aligned to section
      F2FS-fs (zram0): Swapfile (2) is not align to section:
      1) creat(), 2) ioctl(F2FS_IOC_SET_PIN_FILE), 3) fallocate(2097152 * n)
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      859fca6b
    • C
      f2fs: swap: remove dead codes · 0b8fc006
      Chao Yu 提交于
      After commit af4b6b8e ("f2fs: introduce check_swap_activate_fast()"),
      we will never run into original logic of check_swap_activate() before
      f2fs supports non 4k-sized page, so let's delete those dead codes.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0b8fc006
    • C
      f2fs: compress: add compress_inode to cache compressed blocks · 6ce19aff
      Chao Yu 提交于
      Support to use address space of inner inode to cache compressed block,
      in order to improve cache hit ratio of random read.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      6ce19aff
    • J
      f2fs: logging neatening · 833dcd35
      Joe Perches 提交于
      Update the logging uses that have unnecessary newlines as the f2fs_printk
      function and so its f2fs_<level> macro callers already adds one.
      
      This allows searching single line logging entries with an easier grep and
      also avoids unnecessary blank lines in the logging.
      
      Miscellanea:
      
      o Coalesce formats
      o Align to open parenthesis
      Signed-off-by: NJoe Perches <joe@perches.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      833dcd35
  13. 15 5月, 2021 2 次提交
    • S
      f2fs: Prevent swap file in LFS mode · d927ccfc
      Shin'ichiro Kawasaki 提交于
      The kernel writes to swap files on f2fs directly without the assistance
      of the filesystem. This direct write by kernel can be non-sequential
      even when the f2fs is in LFS mode. Such non-sequential write conflicts
      with the LFS semantics. Especially when f2fs is set up on zoned block
      devices, the non-sequential write causes unaligned write command errors.
      
      To avoid the non-sequential writes to swap files, prevent swap file
      activation when the filesystem is in LFS mode.
      
      Fixes: 4969c06a ("f2fs: support swap file w/ DIO")
      Signed-off-by: NShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Cc: stable@vger.kernel.org # v5.10+
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      d927ccfc
    • C
      f2fs: restructure f2fs page.private layout · b763f3be
      Chao Yu 提交于
      Restruct f2fs page private layout for below reasons:
      
      There are some cases that f2fs wants to set a flag in a page to
      indicate a specified status of page:
      a) page is in transaction list for atomic write
      b) page contains dummy data for aligned write
      c) page is migrating for GC
      d) page contains inline data for inline inode flush
      e) page belongs to merkle tree, and is verified for fsverity
      f) page is dirty and has filesystem/inode reference count for writeback
      g) page is temporary and has decompress io context reference for compression
      
      There are existed places in page structure we can use to store
      f2fs private status/data:
      - page.flags: PG_checked, PG_private
      - page.private
      
      However it was a mess when we using them, which may cause potential
      confliction:
      		page.private	PG_private	PG_checked	page._refcount (+1 at most)
      a)		-1		set				+1
      b)		-2		set
      c), d), e)					set
      f)		0		set				+1
      g)		pointer		set
      
      The other problem is page.flags has no free slot, if we can avoid set
      zero to page.private and set PG_private flag, then we use non-zero value
      to indicate PG_private status, so that we may have chance to reclaim
      PG_private slot for other usage. [1]
      
      The other concern is f2fs has bad scalability in aspect of indicating
      more page status.
      
      So in this patch, let's restructure f2fs' page.private as below to
      solve above issues:
      
      Layout A: lowest bit should be 1
      | bit0 = 1 | bit1 | bit2 | ... | bit MAX | private data .... |
       bit 0	PAGE_PRIVATE_NOT_POINTER
       bit 1	PAGE_PRIVATE_ATOMIC_WRITE
       bit 2	PAGE_PRIVATE_DUMMY_WRITE
       bit 3	PAGE_PRIVATE_ONGOING_MIGRATION
       bit 4	PAGE_PRIVATE_INLINE_INODE
       bit 5	PAGE_PRIVATE_REF_RESOURCE
       bit 6-	f2fs private data
      
      Layout B: lowest bit should be 0
       page.private is a wrapped pointer.
      
      After the change:
      		page.private	PG_private	PG_checked	page._refcount (+1 at most)
      a)		11		set				+1
      b)		101		set				+1
      c)		1001		set				+1
      d)		10001		set				+1
      e)						set
      f)		100001		set				+1
      g)		pointer		set				+1
      
      [1] https://lore.kernel.org/linux-f2fs-devel/20210422154705.GO3596236@casper.infradead.org/T/#u
      
      Cc: Matthew Wilcox <willy@infradead.org>
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      b763f3be
  14. 12 5月, 2021 3 次提交
  15. 11 4月, 2021 1 次提交
  16. 26 3月, 2021 1 次提交
  17. 13 3月, 2021 3 次提交
  18. 11 3月, 2021 1 次提交
  19. 27 2月, 2021 1 次提交
  20. 03 2月, 2021 1 次提交
  21. 28 1月, 2021 7 次提交