linux-stable/fs/f2fs
Chao Yu 859fca6b70 f2fs: swap: support migrating swapfile in aligned write mode
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: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-06-23 01:09:35 -07:00
..
acl.c f2fs: clean up build warnings 2021-04-10 10:36:39 -07:00
acl.h fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
checkpoint.c f2fs: restructure f2fs page.private layout 2021-05-14 11:22:08 -07:00
compress.c f2fs: compress: add compress_inode to cache compressed blocks 2021-06-23 01:09:35 -07:00
data.c f2fs: swap: support migrating swapfile in aligned write mode 2021-06-23 01:09:35 -07:00
debug.c f2fs: compress: add compress_inode to cache compressed blocks 2021-06-23 01:09:35 -07:00
dir.c f2fs: restructure f2fs page.private layout 2021-05-14 11:22:08 -07:00
extent_cache.c f2fs: support 64-bits key in f2fs rb-tree node entry 2020-09-10 14:03:30 -07:00
f2fs.h f2fs: swap: support migrating swapfile in aligned write mode 2021-06-23 01:09:35 -07:00
file.c f2fs: logging neatening 2021-06-23 01:09:34 -07:00
gc.c f2fs: compress: add compress_inode to cache compressed blocks 2021-06-23 01:09:35 -07:00
gc.h f2fs: introduce gc_merge mount option 2021-03-30 18:48:56 -07:00
hash.c f2fs: Handle casefolding with Encryption 2020-12-02 22:00:21 -08:00
inline.c f2fs: restructure f2fs page.private layout 2021-05-14 11:22:08 -07:00
inode.c f2fs: compress: add compress_inode to cache compressed blocks 2021-06-23 01:09:35 -07:00
Kconfig f2fs: compress: Allow modular (de)compression algorithms 2021-03-12 13:16:42 -08:00
Makefile f2fs: deprecate f2fs_trace_io 2021-01-27 15:20:07 -08:00
namei.c f2fs: compress: fix to disallow temp extension 2021-05-26 07:00:36 -07:00
node.c f2fs: compress: add compress_inode to cache compressed blocks 2021-06-23 01:09:35 -07:00
node.h f2fs: swap: support migrating swapfile in aligned write mode 2021-06-23 01:09:35 -07:00
recovery.c f2fs: fix to avoid racing on fsync_entry_slab by multi filesystem instances 2021-05-14 11:22:08 -07:00
segment.c f2fs: swap: support migrating swapfile in aligned write mode 2021-06-23 01:09:35 -07:00
segment.h f2fs-for-5.13-rc1 2021-05-04 18:03:38 -07:00
shrinker.c f2fs: avoid race condition for shrinker count 2020-12-03 00:59:26 -08:00
super.c f2fs: compress: add compress_inode to cache compressed blocks 2021-06-23 01:09:35 -07:00
sysfs.c f2fs: clean up /sys/fs/f2fs/<disk>/features 2021-06-23 01:09:35 -07:00
verity.c f2fs-for-5.13-rc1 2021-05-04 18:03:38 -07:00
xattr.c f2fs: clean up build warnings 2021-04-10 10:36:39 -07:00
xattr.h f2fs: code cleanup by removing ifdef macro surrounding 2020-05-26 18:56:10 -07:00