aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-08-08 02:16:22 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-08-26 07:02:12 -0400
commit444c580f7e9ad29927a5d5269d576bd7cdccebb8 (patch)
treece7dd44ceb0a7da467c61f58903a4e151db2af7c /fs
parent6e6b978c32bacd98a93e34af7f4222e76007705f (diff)
f2fs: add flags for inline xattrs
This patch adds basic inode flags for inline xattrs, F2FS_INLINE_XATTR, and add a mount option, inline_xattr, which is enabled when xattr is set. If the mount option is enabled, all the files are marked with the inline_xattrs flag. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/f2fs.h18
-rw-r--r--fs/f2fs/inode.c2
-rw-r--r--fs/f2fs/super.c14
3 files changed, 34 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 5348b63adbe9..b82f14199921 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -29,6 +29,7 @@
29#define F2FS_MOUNT_XATTR_USER 0x00000010 29#define F2FS_MOUNT_XATTR_USER 0x00000010
30#define F2FS_MOUNT_POSIX_ACL 0x00000020 30#define F2FS_MOUNT_POSIX_ACL 0x00000020
31#define F2FS_MOUNT_DISABLE_EXT_IDENTIFY 0x00000040 31#define F2FS_MOUNT_DISABLE_EXT_IDENTIFY 0x00000040
32#define F2FS_MOUNT_INLINE_XATTR 0x00000080
32 33
33#define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option) 34#define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
34#define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option) 35#define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option)
@@ -892,6 +893,7 @@ enum {
892 FI_NO_ALLOC, /* should not allocate any blocks */ 893 FI_NO_ALLOC, /* should not allocate any blocks */
893 FI_UPDATE_DIR, /* should update inode block for consistency */ 894 FI_UPDATE_DIR, /* should update inode block for consistency */
894 FI_DELAY_IPUT, /* used for the recovery */ 895 FI_DELAY_IPUT, /* used for the recovery */
896 FI_INLINE_XATTR, /* used for inline xattr */
895}; 897};
896 898
897static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag) 899static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag)
@@ -924,6 +926,22 @@ static inline int cond_clear_inode_flag(struct f2fs_inode_info *fi, int flag)
924 return 0; 926 return 0;
925} 927}
926 928
929static inline void get_inline_info(struct f2fs_inode_info *fi,
930 struct f2fs_inode *ri)
931{
932 if (ri->i_inline & F2FS_INLINE_XATTR)
933 set_inode_flag(fi, FI_INLINE_XATTR);
934}
935
936static inline void set_raw_inline(struct f2fs_inode_info *fi,
937 struct f2fs_inode *ri)
938{
939 ri->i_inline = 0;
940
941 if (is_inode_flag_set(fi, FI_INLINE_XATTR))
942 ri->i_inline |= F2FS_INLINE_XATTR;
943}
944
927static inline int f2fs_readonly(struct super_block *sb) 945static inline int f2fs_readonly(struct super_block *sb)
928{ 946{
929 return sb->s_flags & MS_RDONLY; 947 return sb->s_flags & MS_RDONLY;
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 7f8569bd8759..9339cd292047 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -85,6 +85,7 @@ static int do_read_inode(struct inode *inode)
85 fi->i_advise = ri->i_advise; 85 fi->i_advise = ri->i_advise;
86 fi->i_pino = le32_to_cpu(ri->i_pino); 86 fi->i_pino = le32_to_cpu(ri->i_pino);
87 get_extent_info(&fi->ext, ri->i_ext); 87 get_extent_info(&fi->ext, ri->i_ext);
88 get_inline_info(fi, ri);
88 f2fs_put_page(node_page, 1); 89 f2fs_put_page(node_page, 1);
89 return 0; 90 return 0;
90} 91}
@@ -164,6 +165,7 @@ void update_inode(struct inode *inode, struct page *node_page)
164 ri->i_size = cpu_to_le64(i_size_read(inode)); 165 ri->i_size = cpu_to_le64(i_size_read(inode));
165 ri->i_blocks = cpu_to_le64(inode->i_blocks); 166 ri->i_blocks = cpu_to_le64(inode->i_blocks);
166 set_raw_extent(&F2FS_I(inode)->ext, &ri->i_ext); 167 set_raw_extent(&F2FS_I(inode)->ext, &ri->i_ext);
168 set_raw_inline(F2FS_I(inode), ri);
167 169
168 ri->i_atime = cpu_to_le64(inode->i_atime.tv_sec); 170 ri->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
169 ri->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 171 ri->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index d28c4528eff8..70ecf484e7e5 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -47,6 +47,7 @@ enum {
47 Opt_noacl, 47 Opt_noacl,
48 Opt_active_logs, 48 Opt_active_logs,
49 Opt_disable_ext_identify, 49 Opt_disable_ext_identify,
50 Opt_inline_xattr,
50 Opt_err, 51 Opt_err,
51}; 52};
52 53
@@ -59,6 +60,7 @@ static match_table_t f2fs_tokens = {
59 {Opt_noacl, "noacl"}, 60 {Opt_noacl, "noacl"},
60 {Opt_active_logs, "active_logs=%u"}, 61 {Opt_active_logs, "active_logs=%u"},
61 {Opt_disable_ext_identify, "disable_ext_identify"}, 62 {Opt_disable_ext_identify, "disable_ext_identify"},
63 {Opt_inline_xattr, "inline_xattr"},
62 {Opt_err, NULL}, 64 {Opt_err, NULL},
63}; 65};
64 66
@@ -238,11 +240,18 @@ static int parse_options(struct super_block *sb, char *options)
238 case Opt_nouser_xattr: 240 case Opt_nouser_xattr:
239 clear_opt(sbi, XATTR_USER); 241 clear_opt(sbi, XATTR_USER);
240 break; 242 break;
243 case Opt_inline_xattr:
244 set_opt(sbi, INLINE_XATTR);
245 break;
241#else 246#else
242 case Opt_nouser_xattr: 247 case Opt_nouser_xattr:
243 f2fs_msg(sb, KERN_INFO, 248 f2fs_msg(sb, KERN_INFO,
244 "nouser_xattr options not supported"); 249 "nouser_xattr options not supported");
245 break; 250 break;
251 case Opt_inline_xattr:
252 f2fs_msg(sb, KERN_INFO,
253 "inline_xattr options not supported");
254 break;
246#endif 255#endif
247#ifdef CONFIG_F2FS_FS_POSIX_ACL 256#ifdef CONFIG_F2FS_FS_POSIX_ACL
248 case Opt_noacl: 257 case Opt_noacl:
@@ -292,6 +301,9 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb)
292 301
293 set_inode_flag(fi, FI_NEW_INODE); 302 set_inode_flag(fi, FI_NEW_INODE);
294 303
304 if (test_opt(F2FS_SB(sb), INLINE_XATTR))
305 set_inode_flag(fi, FI_INLINE_XATTR);
306
295 return &fi->vfs_inode; 307 return &fi->vfs_inode;
296} 308}
297 309
@@ -444,6 +456,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
444 seq_puts(seq, ",user_xattr"); 456 seq_puts(seq, ",user_xattr");
445 else 457 else
446 seq_puts(seq, ",nouser_xattr"); 458 seq_puts(seq, ",nouser_xattr");
459 if (test_opt(sbi, INLINE_XATTR))
460 seq_puts(seq, ",inline_xattr");
447#endif 461#endif
448#ifdef CONFIG_F2FS_FS_POSIX_ACL 462#ifdef CONFIG_F2FS_FS_POSIX_ACL
449 if (test_opt(sbi, POSIX_ACL)) 463 if (test_opt(sbi, POSIX_ACL))