Patchwork [21/36,v4] debugfs: make expand_dir cmd support inline data

login
register
mail settings
Submitter Zheng Liu
Date July 31, 2012, 11:48 a.m.
Message ID <1343735309-30579-22-git-send-email-wenqing.lz@taobao.com>
Download mbox | patch
Permalink /patch/174239/
State Superseded
Headers show

Comments

Zheng Liu - July 31, 2012, 11:48 a.m.
From: Zheng Liu <wenqing.lz@taobao.com>

expand_dir command allocates two new block for the dir.  It firstly allocates
a new block, and copies all of inline data into this block.  Then it allocates
another block for this dir.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 lib/ext2fs/expanddir.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Patch

diff --git a/lib/ext2fs/expanddir.c b/lib/ext2fs/expanddir.c
index 22558d6..8ba8a23 100644
--- a/lib/ext2fs/expanddir.c
+++ b/lib/ext2fs/expanddir.c
@@ -114,8 +114,12 @@  errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir)
 	es.newblocks = 0;
 	es.dir = dir;
 
-	retval = ext2fs_block_iterate3(fs, dir, BLOCK_FLAG_APPEND,
-				       0, expand_dir_proc, &es);
+	if (ext2fs_has_inline_data(fs, dir))
+		retval = ext2fs_inline_data_expand_dir(fs, dir, BLOCK_CHANGED,
+						       0, expand_dir_proc, &es);
+	else
+		retval = ext2fs_block_iterate3(fs, dir, BLOCK_FLAG_APPEND,
+					       0, expand_dir_proc, &es);
 
 	if (es.err)
 		return es.err;