[f2fs-dev][PATCH 0/5] f2fs: support inline dir

From: Chao Yu
Date: Fri Aug 08 2014 - 22:45:35 EST


There are large space in f2fs inode, so last inline data patch set have made
f2fs to acquire the ability of storing data of small file (less than ~3.4k)
directly in inode block, but not support inline dir. In this patch, we make
f2fs to support inline dir.

Layout:
Inline dir layout is the same as inline data layout,
a. i_addr[0] are reserved space for converting from inline dir to regular one
when out-of-space occur in inline dentry.
b. i_addr[1..872] will be used as storing space of inline dentry.
c. i_addr[873..922] are reserved for inline xattr.

Size:
Since our max size of inline dir space is limit to MAX_INLINE_DATA (3488 bytes),
we introduce inline dentry struct fit for available space, then our dentry slot
number in inline dentry reduce to 182, less than normal dentry block's 214.

Process:
In inline dir mode, our dir entries will be lookuped/stored/deleted in the
inline dentry space of inode, util there are no more space to store new added
dir entry, in this case we will convert inline dentry to normal 0-index dentry
block and disable inline dir mode for this inode.

Benefit points:
a) space saving
1) Test with fsstress with special arguments, it can save about 3% space.
time fsstress -c -p 20 -n 500 -l 10 -d /mnt/f2fs -w -f chown=0 -f creat=10
-f dwrite=0 -f fdatasync=0 -f fsync=0 -f link=10 -f mkdir=10 -f mknod=10
-f rename=0 -f rmdir=0 -f symlink=10 -f truncate=0 -f unlink=0 -f write=10 -S
based /dev/sdb 20969472 2234136 18591976 11% /mnt/f2fs
patched /dev/sdb 20969472 2303120 18522992 12% /mnt/f2fs
2) Test with storing kernel src, it can save less than 1% space.

b) performance
Test with fsstress shows cost time reduce 21%.
time fsstress -d /mnt/f2fs -l 5 -n 1000 -p 20 -c -r
based 168.503 s (inline data)
patched 132.840 s (inline data + inline dir)

Chao Yu (5):
f2fs: add infra macro and sturct for inline dir
f2fs: export dir operations for inline dir
f2fs: add key function to handle inline dir
f2fs: enable inline dir handling
f2fs: update f2fs documentation

Documentation/filesystems/f2fs.txt | 5 +-
fs/f2fs/dir.c | 48 +++--
fs/f2fs/f2fs.h | 18 +-
fs/f2fs/inline.c | 388 +++++++++++++++++++++++++++++++++++++
fs/f2fs/namei.c | 8 +-
fs/f2fs/recovery.c | 2 +-
include/linux/f2fs_fs.h | 18 ++
7 files changed, 469 insertions(+), 18 deletions(-)

--
2.0.1.474.g72c7794


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/