diff options
author | Sheng Yong <shengyong1@huawei.com> | 2018-03-15 06:51:41 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-03-17 01:02:47 -0400 |
commit | b7c409deda6bcaaa6452b015937a013dd8b481b4 (patch) | |
tree | 5da0435f1eb10a51ff068c2793dac3512bb6778d /fs/f2fs/sysfs.c | |
parent | da5ce874f8cabe18bc34b50856933108830663bc (diff) |
f2fs: introduce F2FS_FEATURE_LOST_FOUND feature
This patch introduces a new feature, F2FS_FEATURE_LOST_FOUND, which
is set by mkfs. mkfs creates a directory named lost+found, which saves
unreachable files. If fsck finds a file which has no parent, or its
parent is removed by fsck, the file will be placed under lost+found
directory by fsck.
lost+found directory could not be encrypted. As a result, the root
directory cannot be encrypted too. So if LOST_FOUND feature is enabled,
let's avoid to encrypt root directory.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/sysfs.c')
-rw-r--r-- | fs/f2fs/sysfs.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 7d983ad19da4..f33a56d6e6dd 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c | |||
@@ -116,6 +116,9 @@ static ssize_t features_show(struct f2fs_attr *a, | |||
116 | if (f2fs_sb_has_inode_crtime(sb)) | 116 | if (f2fs_sb_has_inode_crtime(sb)) |
117 | len += snprintf(buf + len, PAGE_SIZE - len, "%s%s", | 117 | len += snprintf(buf + len, PAGE_SIZE - len, "%s%s", |
118 | len ? ", " : "", "inode_crtime"); | 118 | len ? ", " : "", "inode_crtime"); |
119 | if (f2fs_sb_has_lost_found(sb)) | ||
120 | len += snprintf(buf + len, PAGE_SIZE - len, "%s%s", | ||
121 | len ? ", " : "", "lost_found"); | ||
119 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | 122 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); |
120 | return len; | 123 | return len; |
121 | } | 124 | } |
@@ -292,6 +295,7 @@ enum feat_id { | |||
292 | FEAT_FLEXIBLE_INLINE_XATTR, | 295 | FEAT_FLEXIBLE_INLINE_XATTR, |
293 | FEAT_QUOTA_INO, | 296 | FEAT_QUOTA_INO, |
294 | FEAT_INODE_CRTIME, | 297 | FEAT_INODE_CRTIME, |
298 | FEAT_LOST_FOUND, | ||
295 | }; | 299 | }; |
296 | 300 | ||
297 | static ssize_t f2fs_feature_show(struct f2fs_attr *a, | 301 | static ssize_t f2fs_feature_show(struct f2fs_attr *a, |
@@ -307,6 +311,7 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a, | |||
307 | case FEAT_FLEXIBLE_INLINE_XATTR: | 311 | case FEAT_FLEXIBLE_INLINE_XATTR: |
308 | case FEAT_QUOTA_INO: | 312 | case FEAT_QUOTA_INO: |
309 | case FEAT_INODE_CRTIME: | 313 | case FEAT_INODE_CRTIME: |
314 | case FEAT_LOST_FOUND: | ||
310 | return snprintf(buf, PAGE_SIZE, "supported\n"); | 315 | return snprintf(buf, PAGE_SIZE, "supported\n"); |
311 | } | 316 | } |
312 | return 0; | 317 | return 0; |
@@ -386,6 +391,7 @@ F2FS_FEATURE_RO_ATTR(inode_checksum, FEAT_INODE_CHECKSUM); | |||
386 | F2FS_FEATURE_RO_ATTR(flexible_inline_xattr, FEAT_FLEXIBLE_INLINE_XATTR); | 391 | F2FS_FEATURE_RO_ATTR(flexible_inline_xattr, FEAT_FLEXIBLE_INLINE_XATTR); |
387 | F2FS_FEATURE_RO_ATTR(quota_ino, FEAT_QUOTA_INO); | 392 | F2FS_FEATURE_RO_ATTR(quota_ino, FEAT_QUOTA_INO); |
388 | F2FS_FEATURE_RO_ATTR(inode_crtime, FEAT_INODE_CRTIME); | 393 | F2FS_FEATURE_RO_ATTR(inode_crtime, FEAT_INODE_CRTIME); |
394 | F2FS_FEATURE_RO_ATTR(lost_found, FEAT_LOST_FOUND); | ||
389 | 395 | ||
390 | #define ATTR_LIST(name) (&f2fs_attr_##name.attr) | 396 | #define ATTR_LIST(name) (&f2fs_attr_##name.attr) |
391 | static struct attribute *f2fs_attrs[] = { | 397 | static struct attribute *f2fs_attrs[] = { |
@@ -441,6 +447,7 @@ static struct attribute *f2fs_feat_attrs[] = { | |||
441 | ATTR_LIST(flexible_inline_xattr), | 447 | ATTR_LIST(flexible_inline_xattr), |
442 | ATTR_LIST(quota_ino), | 448 | ATTR_LIST(quota_ino), |
443 | ATTR_LIST(inode_crtime), | 449 | ATTR_LIST(inode_crtime), |
450 | ATTR_LIST(lost_found), | ||
444 | NULL, | 451 | NULL, |
445 | }; | 452 | }; |
446 | 453 | ||