Patchwork [v2,07/15] ext4: add a function which adds several group descriptors

login
register
mail settings
Submitter Yongqiang Yang
Date Aug. 30, 2011, 8:10 a.m.
Message ID <1314691825-12295-8-git-send-email-xiaoqiangnk@gmail.com>
Download mbox | patch
Permalink /patch/112199/
State Superseded
Headers show

Comments

Yongqiang Yang - Aug. 30, 2011, 8:10 a.m.
This patch adds a functon named ext4_add_new_descs() which adds
several  group descriptors each time.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
 fs/ext4/resize.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

Patch

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 7b1b8ac..53412bf 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1082,6 +1082,31 @@  out:
 }
 
 /*
+ * ext4_add_new_descs() adds @count group descriptor of groups
+ * starting at @group
+ *
+ * @handle: journal handle
+ * @sb; super block
+ * @group: the group no. of the first group desc to be added
+ * @resize_inode: the resize inode
+ * @count: number of group descriptors to be added
+ */
+static int ext4_add_new_descs(handle_t *handle, struct super_block *sb,
+			ext4_group_t group, struct inode *resize_inode,
+			ext4_group_t count)
+{
+	int i, err = 0;
+
+	for (i = 0; i < count; i++) {
+		err = ext4_add_new_desc(handle, sb, group + i, resize_inode);
+		if (err)
+			return err;
+	}
+
+	return err;
+}
+
+/*
  * ext4_setup_new_desc() sets up group descriptors specified by @input.
  *
  * @handle: journal handle