]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Store the RAID stride value in the superblock and take advantage of it
authorTheodore Ts'o <tytso@mit.edu>
Sat, 19 May 2007 02:06:53 +0000 (22:06 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 19 May 2007 02:06:53 +0000 (22:06 -0400)
Store the RAID stride value when a filesystem is created with a requested
RAID stride, and then use it automatically in resize2fs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/ChangeLog
lib/ext2fs/ext2_fs.h
lib/ext2fs/openfs.c
misc/ChangeLog
misc/mke2fs.c
resize/ChangeLog
resize/main.c

index 64bc8deefba831a1aaf0e6c3c28dfbc8578c65f8..6806b1f0253fcf7770aa29df18b0706c239eddb4 100644 (file)
@@ -1,3 +1,10 @@
+2007-05-18  Theodore Tso  <tytso@mit.edu>
+
+       * openfs.c (ext2fs_open2): Set fs->stride from the superblock's
+               s_raid_stride value.
+
+       * ext2_fs.h: Allocate space for RAID stride in the superblock.
+
 2007-05-08  Eric Sandeen <sandeen@redhat.com>
 
        * ext2_fs.h (inode_uid, inode_gid): The inode_uid() and
index e13eba4a1ff8230feee063973e8531f17cf1d0b7..98f34fc826724d0f1b544cd088875358207becea 100644 (file)
@@ -573,7 +573,9 @@ struct ext2_super_block {
        __u16   s_min_extra_isize;      /* All inodes have at least # bytes */
        __u16   s_want_extra_isize;     /* New inodes should reserve # bytes */
        __u32   s_flags;                /* Miscellaneous flags */
-       __u32   s_reserved[167];        /* Padding to the end of the block */
+       __u16   s_raid_stride;          /* RAID stride */
+       __u16   s_pad;                  /* Padding */
+       __u32   s_reserved[166];        /* Padding to the end of the block */
 };
 
 /*
index 505011750450f9a7c797353f6fa252b762f02fd7..ea1037304f830fb448e1ebde03d2d1f015431245 100644 (file)
@@ -297,6 +297,8 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
                dest += fs->blocksize;
        }
 
+       fs->stride = fs->super->s_raid_stride;
+
        *ret_fs = fs;
        return 0;
 cleanup:
index 6cb755eaf9a8009220485211ac9905e391e945cc..4a96f75b06f5d85eb5bcb8c6ddd1528ca9e08a88 100644 (file)
@@ -1,5 +1,7 @@
 2007-05-18  Theodore Tso  <tytso@mit.edu>
 
+       * mke2fs.c (main): Save the raid stride to the superblock
+
        * blkid.c (main): Add -g option to blkid which will garbage
                collect the cache.
 
index 41b09ab6a756a6b84ee18443c6d40dc5851029a3..0a3713799654acc3f983ac2fc07130427bf38b50 100644 (file)
@@ -1611,7 +1611,7 @@ int main (int argc, char *argv[])
                test_disk(fs, &bb_list);
 
        handle_bad_blocks(fs, bb_list);
-       fs->stride = fs_stride;
+       fs->stride = fs->super->s_raid_stride = fs_stride;
        retval = ext2fs_allocate_tables(fs);
        if (retval) {
                com_err(program_name, retval,
index 866eb5565dafa98122c0a2e614ba6bcea3562dad..d0f0fae6a9f77a4d43c06d2d234c76070ca7beb0 100644 (file)
@@ -1,3 +1,9 @@
+2007-05-18  Theodore Tso  <tytso@mit.edu>
+
+       * main.c (determine_fs_stride): Use the superblock s_raid_stride
+               if it is set; save the hueristically determined stride to
+               the superblock if it is not set.
+
 2007-03-18  Theodore Tso  <tytso@mit.edu>
 
        * resize2fs.c (check_and_change_inodes): Check to make sure the
index e71bbde0cf393d88b7f19d4b50f8205fa2334f07..f9d8b848341f1ecad5bc1afd125c1dc4b44cdc8b 100644 (file)
@@ -101,6 +101,8 @@ static void determine_fs_stride(ext2_filsys fs)
        unsigned int    has_sb, prev_has_sb, num;
        int             i_stride, b_stride;
 
+       if (fs->stride)
+               return;
        num = 0; sum = 0;
        for (group = 0; group < fs->group_desc_count; group++) {
                has_sb = ext2fs_bg_has_super(fs, group);
@@ -132,6 +134,9 @@ static void determine_fs_stride(ext2_filsys fs)
        else
                fs->stride = 0;
 
+       fs->super->s_raid_stride = fs->stride;
+       ext2fs_mark_super_dirty(fs);
+
 #if 0
        if (fs->stride)
                printf("Using RAID stride of %d\n", fs->stride);
@@ -348,7 +353,8 @@ int main (int argc, char ** argv)
                                _("Invalid stride length"));
                        exit(1);
                }
-               fs->stride = use_stride;
+               fs->stride = fs->super->s_raid_stride = use_stride;
+               ext2fs_mark_super_dirty(fs);
        } else
                  determine_fs_stride(fs);