Skip to contentSkip to conversation

f2fs: expose some sectors to user in inline data or dentry case

PATCH In review Jaegeuk Kim 3 participants 6 messages Oct 13, 2017 – Oct 23, 2017

Subsystems (2)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: expose some sectors to user in inline data or dentry case

If there's some data written through inline data or dentry, we need to shouw st_blocks. This fixes reporting zero blocks even though there is small written data.

---
 fs/f2fs/file.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/f2fs/file.c +5 -0
index 2eb3efe92018..f7be6c394fa8 100644
@@ -698,6 +698,11 @@ int f2fs_getattr(const struct path *path, struct kstat *stat,
 				  STATX_ATTR_NODUMP);
 
 	generic_fillattr(inode, stat);
+
+	/* we need to show initial sectors used for inline_data/dentries */
+	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))
+		stat->blocks += (stat->size + 511) >> 9;
+
 	return 0;
 }
 
Signature · 1 line
2.14.0.rc1.383.gd1ce394fe2-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jaegeuk Kim

If there's some data written through inline data or dentry, we need to shouw st_blocks. This fixes reporting zero blocks even though there is small written data.

Thanks,

Quoted 21 lines
---
 fs/f2fs/file.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/f2fs/file.c +5 -0
index 2eb3efe92018..f7be6c394fa8 100644
@@ -698,6 +698,11 @@ int f2fs_getattr(const struct path *path, struct kstat *stat,
 				  STATX_ATTR_NODUMP);
 
 	generic_fillattr(inode, stat);
+
+	/* we need to show initial sectors used for inline_data/dentries */
+	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))
+		stat->blocks += (stat->size + 511) >> 9;
+
 	return 0;
 }
 
author maintainer
#2 lore raw
Quoted 22 lines · Chao Yu
Quoted 5 lines · Jaegeuk Kim

If there's some data written through inline data or dentry, we need to shouw st_blocks. This fixes reporting zero blocks even though there is small written data.

Thanks,

Quoted 11 lines
---
 fs/f2fs/file.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/f2fs/file.c +0 -0
index 2eb3efe92018..f7be6c394fa8 100644
@@ -698,6 +698,11 @@ int f2fs_getattr(const struct path *path, struct kstat *stat,
 				  STATX_ATTR_NODUMP);
 
Quoted 4 lines

fs/f2fs/file.c int f2fs_getattr(const struct path *path, struct kstat *stat, · line 703

Quoted 4 lines
fs/f2fs/file.c +3 -0
 	generic_fillattr(inode, stat);
+
+	/* we need to show initial sectors used for inline_data/dentries */
+	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))

FYI;
I added S_ISREG(inode->i_mode) with f2fs_has_inline_data() to avoid quotacheck error.

Quoted 6 lines
Quoted 6 lines
fs/f2fs/file.c +2 -0
+		stat->blocks += (stat->size + 511) >> 9;
+
 	return 0;
 }
 
#3 lore raw
Quoted 23 lines · Jaegeuk Kim
Quoted 22 lines · Chao Yu
Quoted 5 lines · Jaegeuk Kim

If there's some data written through inline data or dentry, we need to shouw st_blocks. This fixes reporting zero blocks even though there is small written data.

Thanks,

Quoted 11 lines
---
 fs/f2fs/file.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/f2fs/file.c +0 -0
index 2eb3efe92018..f7be6c394fa8 100644
@@ -698,6 +698,11 @@ int f2fs_getattr(const struct path *path, struct kstat *stat,
 				  STATX_ATTR_NODUMP);
 
Quoted 8 lines
Quoted 4 lines

fs/f2fs/file.c int f2fs_getattr(const struct path *path, struct kstat *stat, · line 703

Quoted 4 lines
fs/f2fs/file.c +3 -0
 	generic_fillattr(inode, stat);
+
+	/* we need to show initial sectors used for inline_data/dentries */
+	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))

FYI;
I added S_ISREG(inode->i_mode) with f2fs_has_inline_data() to avoid quotacheck error.

If this patch is related to quotacheck issue, I doubt that there will be problemetic, in no journalled quota case, fs quota system won't stat blocks in inline file, however, after SPO, when using quotacheck to scan file to recover quota info, blocks of inline file showed in getattr can be stated into quota. That would be inconsistent.

Thanks,

Quoted 10 lines
Quoted 7 lines

fs/f2fs/file.c int f2fs_getattr(const struct path *path, struct kstat *stat, · line 708

Quoted 7 lines
fs/f2fs/file.c +2 -0
+		stat->blocks += (stat->size + 511) >> 9;
+
 	return 0;
 }
 

.

author maintainer
#4 lore raw
Quoted 33 lines · Chao Yu
Quoted 23 lines · Jaegeuk Kim
Quoted 22 lines · Chao Yu
Quoted 5 lines · Jaegeuk Kim

If there's some data written through inline data or dentry, we need to shouw st_blocks. This fixes reporting zero blocks even though there is small written data.

Thanks,

Quoted 11 lines
---
 fs/f2fs/file.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/f2fs/file.c +0 -0
index 2eb3efe92018..f7be6c394fa8 100644
@@ -698,6 +698,11 @@ int f2fs_getattr(const struct path *path, struct kstat *stat,
 				  STATX_ATTR_NODUMP);
 
Quoted 8 lines
Quoted 4 lines

fs/f2fs/file.c int f2fs_getattr(const struct path *path, struct kstat *stat, · line 703

Quoted 4 lines
fs/f2fs/file.c +3 -0
 	generic_fillattr(inode, stat);
+
+	/* we need to show initial sectors used for inline_data/dentries */
+	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))

FYI;
I added S_ISREG(inode->i_mode) with f2fs_has_inline_data() to avoid quotacheck error.

Quoted 5 lines

If this patch is related to quotacheck issue, I doubt that there will be problemetic, in no journalled quota case, fs quota system won't stat blocks in inline file, however, after SPO, when using quotacheck to scan file to recover quota info, blocks of inline file showed in getattr can be stated into quota. That would be inconsistent.

FWIW, quotacheck counts i_blocks via ioctl for normal files. Without this modification, xfstests gives an failure on quota cases.

Quoted 13 lines

Thanks,

Quoted 10 lines
Quoted 7 lines

fs/f2fs/file.c int f2fs_getattr(const struct path *path, struct kstat *stat, · line 708

Quoted 7 lines
fs/f2fs/file.c +2 -0
+		stat->blocks += (stat->size + 511) >> 9;
+
 	return 0;
 }
 

.

maintainer
#5 lore raw
Quoted 34 lines · Jaegeuk Kim
Quoted 33 lines · Chao Yu
Quoted 31 lines · Jaegeuk Kim
Quoted 22 lines · Chao Yu
Quoted 5 lines · Jaegeuk Kim

If there's some data written through inline data or dentry, we need to shouw st_blocks. This fixes reporting zero blocks even though there is small written data.

Thanks,

Quoted 11 lines
---
 fs/f2fs/file.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/f2fs/file.c +0 -0
index 2eb3efe92018..f7be6c394fa8 100644
@@ -698,6 +698,11 @@ int f2fs_getattr(const struct path *path, struct kstat *stat,
 				  STATX_ATTR_NODUMP);
 
Quoted 4 lines

fs/f2fs/file.c int f2fs_getattr(const struct path *path, struct kstat *stat, · line 703

Quoted 4 lines
fs/f2fs/file.c +3 -0
 	generic_fillattr(inode, stat);
+
+	/* we need to show initial sectors used for inline_data/dentries */
+	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))

FYI;
I added S_ISREG(inode->i_mode) with f2fs_has_inline_data() to avoid quotacheck error.

Quoted 8 lines
Quoted 5 lines

If this patch is related to quotacheck issue, I doubt that there will be problemetic, in no journalled quota case, fs quota system won't stat blocks in inline file, however, after SPO, when using quotacheck to scan file to recover quota info, blocks of inline file showed in getattr can be stated into quota. That would be inconsistent.

FWIW, quotacheck counts i_blocks via ioctl for normal files. Without this modification, xfstests gives an failure on quota cases.

OK, let's fix this issue first. ;)

Thanks,

Quoted 23 lines
Quoted 14 lines

Thanks,

Quoted 10 lines
Quoted 7 lines

fs/f2fs/file.c int f2fs_getattr(const struct path *path, struct kstat *stat, · line 708

Quoted 7 lines
fs/f2fs/file.c +2 -0
+		stat->blocks += (stat->size + 511) >> 9;
+
 	return 0;
 }
 

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel