-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlibext2fs-handle-inline_data-in-block-iterator-function
More file actions
42 lines (35 loc) · 1.18 KB
/
libext2fs-handle-inline_data-in-block-iterator-function
File metadata and controls
42 lines (35 loc) · 1.18 KB
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
libext2fs: handle inline_data in block iterator function
From: Zheng Liu <wenqing.lz@taobao.com>
We needn't traverse blocks for an inode which has inline data because no block
belongs to it. After appling this patch, the following commands in debugfs can
handle inline_data feature:
- icheck
- blocks
- filefrag
In some places, block iterator functions are used to traverse blocks of
directory. In this case, we need to check whether inode has inline_data flag or
not, and handle it manually.
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/block.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c
index 68dcb03..4abcedf 100644
--- a/lib/ext2fs/block.c
+++ b/lib/ext2fs/block.c
@@ -345,6 +345,13 @@ errcode_t ext2fs_block_iterate3(ext2_filsys fs,
return ctx.errcode;
/*
+ * If an inode has inline data, we needn't traverse its blocks
+ * because no block belong to this inode.
+ */
+ if (inode.i_flags & EXT4_INLINE_DATA_FL)
+ return ctx.errcode;
+
+ /*
* Check to see if we need to limit large files
*/
if (flags & BLOCK_FLAG_NO_LARGE) {
--
1.7.12.rc0.22.gcdd159b