-
Notifications
You must be signed in to change notification settings - Fork 2
/
tune2fs-add-inline_data-feature-in-tune2fs
70 lines (64 loc) · 2.09 KB
/
tune2fs-add-inline_data-feature-in-tune2fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
tune2fs: add inline_data feature in tune2fs
From: Zheng Liu <[email protected]>
Inline_data feature can be set when ext_attr feature is enabled. Now this
feature only can be enabled because we may be out of space when disabling
it. If this feature is disabled, we need to allocate a block for every
file and directory, and it might exhaust all space.
Signed-off-by: Zheng Liu <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
---
misc/tune2fs.8.in | 5 +++++
misc/tune2fs.c | 17 ++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in
index 55c6dd9..b768fff 100644
--- a/misc/tune2fs.8.in
+++ b/misc/tune2fs.8.in
@@ -531,6 +531,11 @@ Setting the filesystem feature is equivalent to using the
.B \-j
option.
.TP
+.B inline_data
+Allow data to be stored in inode.
+.B Tune2fs
+only supports setting this filesystem feature.
+.TP
.B large_file
Filesystem can contain files that are greater than 2GB. (Modern kernels
set this feature automatically when a file > 2GB is created.)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index c1ecae8..4a33a35 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -137,7 +137,8 @@ static __u32 ok_features[3] = {
EXT2_FEATURE_INCOMPAT_FILETYPE |
EXT3_FEATURE_INCOMPAT_EXTENTS |
EXT4_FEATURE_INCOMPAT_FLEX_BG |
- EXT4_FEATURE_INCOMPAT_MMP,
+ EXT4_FEATURE_INCOMPAT_MMP |
+ EXT4_FEATURE_INCOMPAT_INLINE_DATA,
/* R/O compat */
EXT2_FEATURE_RO_COMPAT_LARGE_FILE |
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|
@@ -995,6 +996,20 @@ mmp_error:
disable_uninit_bg(fs,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM);
+ if (FEATURE_ON(E2P_FEATURE_INCOMPAT,
+ EXT4_FEATURE_INCOMPAT_INLINE_DATA)) {
+ /* Inline_data feature cannot be enabled if ext_attr is
+ * disabled.
+ */
+ if (!(fs->super->s_feature_compat &
+ EXT2_FEATURE_COMPAT_EXT_ATTR)) {
+ fputs(_("The inline_data feature cannot "
+ "be set if ext_attr feature is disabled.\n"),
+ stderr);
+ return 1;
+ }
+ }
+
if (FEATURE_ON(E2P_FEATURE_RO_INCOMPAT,
EXT4_FEATURE_RO_COMPAT_QUOTA)) {
/*
--
1.7.12.rc0.22.gcdd159b