summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHuajun Li <huajun.li@intel.com>2013-11-10 16:13:16 +0100
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-12-23 02:18:03 +0100
commit1001b3479ce96e37aed5e4fcdc3c60126e034d08 (patch)
treefacc6b2f5412ebdefd227d96dac8523ac42c5764 /include
parentf2fs: send REQ_META or REQ_PRIO when reading meta area (diff)
downloadlinux-1001b3479ce96e37aed5e4fcdc3c60126e034d08.tar.xz
linux-1001b3479ce96e37aed5e4fcdc3c60126e034d08.zip
f2fs: add flags and helpers to support inline data
Add new inode flags F2FS_INLINE_DATA and FI_INLINE_DATA to indicate whether the inode has inline data. Inline data makes use of inode block's data indices region to save small file. Currently there are 923 data indices in an inode block. Since inline xattr has made use of the last 50 indices to save its data, there are 873 indices left which can be used for inline data. When FI_INLINE_DATA is set, the layout of inode block's indices region is like below: +-----------------+ | | Reserved. reserve_new_block() will make use of | i_addr[0] | i_addr[0] when we need to reserve a new data block | | to convert inline data into regular one's. |-----------------| | | Used by inline data. A file whose size is less than | i_addr[1~872] | 3488 bytes(~3.4k) and doesn't reserve extra | | blocks by fallocate() can be saved here. |-----------------| | | | i_addr[873~922] | Reserved for inline xattr | | +-----------------+ Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com> Signed-off-by: Huajun Li <huajun.li@intel.com> Signed-off-by: Weihong Xu <weihong.xu@intel.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/f2fs_fs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index bb942f6d5702..aea5eedbb1ca 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -153,6 +153,14 @@ struct f2fs_extent {
#define NODE_DIND_BLOCK (DEF_ADDRS_PER_INODE + 5)
#define F2FS_INLINE_XATTR 0x01 /* file inline xattr flag */
+#define F2FS_INLINE_DATA 0x02 /* file inline data flag */
+
+
+#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \
+ F2FS_INLINE_XATTR_ADDRS - 1))
+
+#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) \
+ - sizeof(__le32)*(DEF_ADDRS_PER_INODE + 5 - 1))
struct f2fs_inode {
__le16 i_mode; /* file mode */