Skip to content

Commit 67cf5b0

Browse files
taoma-tmtytso
authored andcommitted
ext4: add the basic function for inline data support
Implement inline data with xattr. Now we use "system.data" to store xattr, and the xattr will be extended if the i_size is increased while we don't release the space during truncate. Signed-off-by: Tao Ma <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
1 parent 879b382 commit 67cf5b0

File tree

5 files changed

+534
-3
lines changed

5 files changed

+534
-3
lines changed

fs/ext4/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ ext4-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o page-io.o \
99
ext4_jbd2.o migrate.o mballoc.o block_validity.o move_extent.o \
1010
mmp.o indirect.o extents_status.o
1111

12-
ext4-$(CONFIG_EXT4_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
12+
ext4-$(CONFIG_EXT4_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o inline.o
1313
ext4-$(CONFIG_EXT4_FS_POSIX_ACL) += acl.o
1414
ext4-$(CONFIG_EXT4_FS_SECURITY) += xattr_security.o

fs/ext4/ext4.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ struct flex_groups {
402402
#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
403403
#define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */
404404
#define EXT4_EOFBLOCKS_FL 0x00400000 /* Blocks allocated beyond EOF */
405+
#define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data. */
405406
#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
406407

407408
#define EXT4_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */
@@ -458,6 +459,7 @@ enum {
458459
EXT4_INODE_EXTENTS = 19, /* Inode uses extents */
459460
EXT4_INODE_EA_INODE = 21, /* Inode used for large EA */
460461
EXT4_INODE_EOFBLOCKS = 22, /* Blocks allocated beyond EOF */
462+
EXT4_INODE_INLINE_DATA = 28, /* Data in inode. */
461463
EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */
462464
};
463465

@@ -504,6 +506,7 @@ static inline void ext4_check_flag_values(void)
504506
CHECK_FLAG_VALUE(EXTENTS);
505507
CHECK_FLAG_VALUE(EA_INODE);
506508
CHECK_FLAG_VALUE(EOFBLOCKS);
509+
CHECK_FLAG_VALUE(INLINE_DATA);
507510
CHECK_FLAG_VALUE(RESERVED);
508511
}
509512

@@ -918,6 +921,10 @@ struct ext4_inode_info {
918921
/* on-disk additional length */
919922
__u16 i_extra_isize;
920923

924+
/* Indicate the inline data space. */
925+
u16 i_inline_off;
926+
u16 i_inline_size;
927+
921928
#ifdef CONFIG_QUOTA
922929
/* quota space reservation, managed internally by quota code */
923930
qsize_t i_reserved_quota;
@@ -1376,6 +1383,7 @@ enum {
13761383
EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */
13771384
EXT4_STATE_DIOREAD_LOCK, /* Disable support for dio read
13781385
nolocking */
1386+
EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */
13791387
};
13801388

13811389
#define EXT4_INODE_BIT_FNS(name, field, offset) \
@@ -1497,7 +1505,7 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
14971505
#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* data in dirent */
14981506
#define EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM 0x2000 /* use crc32c for bg */
14991507
#define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */
1500-
#define EXT4_FEATURE_INCOMPAT_INLINEDATA 0x8000 /* data in inode */
1508+
#define EXT4_FEATURE_INCOMPAT_INLINE_DATA 0x8000 /* data in inode */
15011509

15021510
#define EXT2_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR
15031511
#define EXT2_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \

0 commit comments

Comments
 (0)