summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-09-24 18:15:19 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2014-11-03 16:07:31 -0800
commit34d67debe02b3b2b035b5bdce0fab75800f9a344 (patch)
treefbe93f75c59654f3652ce6e718658571e272d233 /include
parentaf41d3ee00bf97bfc3bd64bce6d7a92e85955e98 (diff)
downloadlinux-stable-34d67debe02b3b2b035b5bdce0fab75800f9a344.tar.gz
linux-stable-34d67debe02b3b2b035b5bdce0fab75800f9a344.tar.bz2
linux-stable-34d67debe02b3b2b035b5bdce0fab75800f9a344.zip
f2fs: add infra struct and helper for inline dir
This patch defines macro/inline dentry structure, and adds some helpers for inline dir infrastructure. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/f2fs_fs.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 6d7381b41304..63f8303b79ba 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -171,6 +171,7 @@ struct f2fs_extent {
#define F2FS_INLINE_XATTR 0x01 /* file inline xattr flag */
#define F2FS_INLINE_DATA 0x02 /* file inline data flag */
+#define F2FS_INLINE_DENTRY 0x04 /* file inline dentry flag */
#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \
F2FS_INLINE_XATTR_ADDRS - 1))
@@ -436,6 +437,24 @@ struct f2fs_dentry_block {
__u8 filename[NR_DENTRY_IN_BLOCK][F2FS_SLOT_LEN];
} __packed;
+/* for inline dir */
+#define NR_INLINE_DENTRY (MAX_INLINE_DATA * BITS_PER_BYTE / \
+ ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \
+ BITS_PER_BYTE + 1))
+#define INLINE_DENTRY_BITMAP_SIZE ((NR_INLINE_DENTRY + \
+ BITS_PER_BYTE - 1) / BITS_PER_BYTE)
+#define INLINE_RESERVED_SIZE (MAX_INLINE_DATA - \
+ ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \
+ NR_INLINE_DENTRY + INLINE_DENTRY_BITMAP_SIZE))
+
+/* inline directory entry structure */
+struct f2fs_inline_dentry {
+ __u8 dentry_bitmap[INLINE_DENTRY_BITMAP_SIZE];
+ __u8 reserved[INLINE_RESERVED_SIZE];
+ struct f2fs_dir_entry dentry[NR_INLINE_DENTRY];
+ __u8 filename[NR_INLINE_DENTRY][F2FS_SLOT_LEN];
+} __packed;
+
/* file types used in inode_info->flags */
enum {
F2FS_FT_UNKNOWN,