[gfs2-utils] 32/38: gfs2-utils tests: Add tests for device topology
handling in mkfs.gfs2
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit 4d6d0ece609f34f297fac3616e3c1a6308325a55
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Jan 26 16:33:51 2017 +0000
gfs2-utils tests: Add tests for device topology handling in mkfs.gfs2
Add some tests that exercise mkfs.gfs2 against various device i/o limits
based on odd values seen in the wild.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
tests/mkfs.at | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/mkfs.at b/tests/mkfs.at
index d3521c8..c026a76 100644
--- a/tests/mkfs.at
+++ b/tests/mkfs.at
@@ -101,3 +101,11 @@ AT_CHECK([$GFS_MKFS -p lock_dlm -t "quite_long_cluster_name_test_here:intec34p"
AT_CHECK([$GFS_MKFS -p lock_dlm -t "financial_cluster:this_time_we_test_fs_naming_len" $GFS_TGT], 255, [ignore], [ignore])
GFS_FSCK_CHECK([$GFS_MKFS -p lock_dlm -t "a_really_long_named_cluster_here:concurrently_lets_check_fs_len" $GFS_TGT])
AT_CLEANUP
+
+AT_SETUP([Device i/o limits handling])
+AT_KEYWORDS(mkfs.gfs2 mkfs)
+AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:0:0:0:0 $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=7168:512:0:33553920:512 $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=7168:512:8192:33553920:512 $GFS_TGT], 0, [ignore], [Warning: device is not properly aligned. This may harm performance.
+])
+AT_CLEANUP
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 31/38: mkfs.gfs2: Disregard device topology if
zero-sized sectors reported
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit ed6de57dc4d778efca313430cbc3d4fa769544b6
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Jan 26 16:29:21 2017 +0000
mkfs.gfs2: Disregard device topology if zero-sized sectors reported
Guard against physical_sector_size or logical_sector_size being zero.
Normally this isn't a problem as the kernel will report these values as
the device sector size but the checks are useful for when zero values
are passed to mkfs.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index e2c4a22..0801a4b 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -136,6 +136,7 @@ struct mkfs_opts {
unsigned got_lockproto:1;
unsigned got_locktable:1;
unsigned got_device:1;
+ unsigned got_topol:1;
unsigned override:1;
unsigned quiet:1;
@@ -304,7 +305,8 @@ static void opt_parse_extended(char *str, struct mkfs_opts *opts)
} else if (strcmp("test_topology", key) == 0) {
if (parse_topology(opts, val) != 0)
exit(-1);
- opts->dev.got_topol = 1;
+ opts->got_topol = (opts->dev.logical_sector_size != 0 &&
+ opts->dev.physical_sector_size != 0);
} else if (strcmp("help", key) == 0) {
print_ext_opts();
exit(0);
@@ -487,20 +489,21 @@ static unsigned choose_blocksize(struct mkfs_opts *opts)
unsigned int x;
unsigned int bsize = opts->bsize;
struct mkfs_dev *dev = &opts->dev;
+ int got_topol = (dev->got_topol || opts->got_topol);
- if (dev->got_topol && opts->debug) {
+ if (got_topol && opts->debug) {
printf("alignment_offset: %lu\n", dev->alignment_offset);
printf("logical_sector_size: %lu\n", dev->logical_sector_size);
printf("minimum_io_size: %lu\n", dev->minimum_io_size);
printf("optimal_io_size: %lu\n", dev->optimal_io_size);
printf("physical_sector_size: %lu\n", dev->physical_sector_size);
}
- if (dev->got_topol && dev->alignment_offset != 0) {
+ if (got_topol && dev->alignment_offset != 0) {
fprintf(stderr,
_("Warning: device is not properly aligned. This may harm performance.\n"));
dev->physical_sector_size = dev->logical_sector_size;
}
- if (!opts->got_bsize && dev->got_topol) {
+ if (!opts->got_bsize && got_topol) {
if (dev->optimal_io_size <= getpagesize() &&
dev->optimal_io_size >= dev->minimum_io_size)
bsize = dev->optimal_io_size;
@@ -887,7 +890,8 @@ static int probe_contents(struct mkfs_dev *dev)
dev->minimum_io_size = blkid_topology_get_minimum_io_size(tp);
dev->optimal_io_size = blkid_topology_get_optimal_io_size(tp);
dev->physical_sector_size = blkid_topology_get_physical_sector_size(tp);
- dev->got_topol = 1;
+ dev->got_topol = (dev->logical_sector_size != 0 &&
+ dev->physical_sector_size != 0);
}
}
@@ -944,7 +948,7 @@ int main(int argc, char *argv[])
opts_get(argc, argv, &opts);
opts_check(&opts);
- open_dev(&opts.dev, !opts.dev.got_topol);
+ open_dev(&opts.dev, !opts.got_topol);
bsize = choose_blocksize(&opts);
if (S_ISREG(opts.dev.stat.st_mode)) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 30/38: mkfs.gfs2: Disable rgrp alignment when dev
topology is unsuitable
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit a04341123a7b705c3867e4b6b8ed4933ec943242
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Jan 26 11:05:42 2017 +0000
mkfs.gfs2: Disable rgrp alignment when dev topology is unsuitable
If optimal_io_size is not a multiple of minimum_io_size then the values
are not reliable swidth and sunit values, so disable rgrp stripe
alignment in that case.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index db83d1c..e2c4a22 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -629,8 +629,14 @@ static lgfs2_rgrps_t rgs_init(struct mkfs_opts *opts, struct gfs2_sbd *sdp)
al_off = opts->sunit / sdp->bsize;
}
} else if (opts->align) {
- if ((opts->dev.minimum_io_size > opts->dev.physical_sector_size) &&
- (opts->dev.optimal_io_size > opts->dev.physical_sector_size)) {
+ if (opts->dev.optimal_io_size <= opts->dev.physical_sector_size ||
+ opts->dev.minimum_io_size <= opts->dev.physical_sector_size ||
+ (opts->dev.optimal_io_size % opts->dev.minimum_io_size) != 0) {
+ /* If optimal_io_size is not a multiple of minimum_io_size then
+ the values are not reliable swidth and sunit values, so disable
+ rgrp alignment */
+ opts->align = 0;
+ } else {
al_base = opts->dev.optimal_io_size / sdp->bsize;
al_off = opts->dev.minimum_io_size / sdp->bsize;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 29/38: mkfs.gfs2: Warn when device is misaligned
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit ffb48cdeefbd3222c9c4499fd07c29672f2ae8af
Author: Andrew Price <anprice(a)redhat.com>
Date: Wed Jan 25 14:02:48 2017 +0000
mkfs.gfs2: Warn when device is misaligned
Normally one layer of the I/O stack will adjust for a non-zero
alignment_offset value and expose it to upper layers as zero. If a
misalignment is not accounted for, mkfs.gfs2 will see a non-zero
alignment_offset and should report the misalignment to the user as it
could harm performance.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index a2d2ba9..db83d1c 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -495,7 +495,11 @@ static unsigned choose_blocksize(struct mkfs_opts *opts)
printf("optimal_io_size: %lu\n", dev->optimal_io_size);
printf("physical_sector_size: %lu\n", dev->physical_sector_size);
}
-
+ if (dev->got_topol && dev->alignment_offset != 0) {
+ fprintf(stderr,
+ _("Warning: device is not properly aligned. This may harm performance.\n"));
+ dev->physical_sector_size = dev->logical_sector_size;
+ }
if (!opts->got_bsize && dev->got_topol) {
if (dev->optimal_io_size <= getpagesize() &&
dev->optimal_io_size >= dev->minimum_io_size)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 28/38: mkfs.gfs2: Add an extended option for device
topology testing
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit ae8436467014eadb17536f83feae69d1e26a8b98
Author: Andrew Price <anprice(a)redhat.com>
Date: Wed Jan 25 08:44:44 2017 +0000
mkfs.gfs2: Add an extended option for device topology testing
This adds an -o test_topology=v1:v2:v3:v4:v5 extended option which can
be used to test how mkfs.gfs2 behaves with different device
characteristics. The values it accepts correspond to:
1. alignment_offset
2. logical_sector_size
3. minimum_io_size
4. optimal_io_size
5. physical_sector_size
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 363878c..a2d2ba9 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -256,6 +256,33 @@ static unsigned parse_bool(struct mkfs_opts *opts, const char *key, const char *
exit(-1);
}
+static int parse_topology(struct mkfs_opts *opts, char *str)
+{
+ char *opt;
+ unsigned i = 0;
+ unsigned long *topol[5] = {
+ &opts->dev.alignment_offset,
+ &opts->dev.logical_sector_size,
+ &opts->dev.minimum_io_size,
+ &opts->dev.optimal_io_size,
+ &opts->dev.physical_sector_size
+ };
+
+ while ((opt = strsep(&str, ":")) != NULL) {
+ if (i > 4) {
+ fprintf(stderr, "Too many topology values.\n");
+ return 1;
+ }
+ *topol[i] = parse_ulong(opts, "test_topology", opt);
+ i++;
+ }
+ if (i < 5) {
+ fprintf(stderr, "Too few topology values.\n");
+ return 1;
+ }
+ return 0;
+}
+
static void opt_parse_extended(char *str, struct mkfs_opts *opts)
{
char *opt;
@@ -274,6 +301,10 @@ static void opt_parse_extended(char *str, struct mkfs_opts *opts)
opts->got_swidth = 1;
} else if (strcmp("align", key) == 0) {
opts->align = parse_bool(opts, "align", val);
+ } else if (strcmp("test_topology", key) == 0) {
+ if (parse_topology(opts, val) != 0)
+ exit(-1);
+ opts->dev.got_topol = 1;
} else if (strcmp("help", key) == 0) {
print_ext_opts();
exit(0);
@@ -854,7 +885,7 @@ static int probe_contents(struct mkfs_dev *dev)
return 0;
}
-static void open_dev(struct mkfs_dev *dev)
+static void open_dev(struct mkfs_dev *dev, int withprobe)
{
int error;
@@ -882,9 +913,7 @@ static void open_dev(struct mkfs_dev *dev)
fprintf(stderr, _("'%s' is not a block device or regular file\n"), dev->path);
exit(1);
}
-
- error = probe_contents(dev);
- if (error)
+ if (withprobe && (probe_contents(dev) != 0))
exit(1);
}
@@ -905,7 +934,7 @@ int main(int argc, char *argv[])
opts_get(argc, argv, &opts);
opts_check(&opts);
- open_dev(&opts.dev);
+ open_dev(&opts.dev, !opts.dev.got_topol);
bsize = choose_blocksize(&opts);
if (S_ISREG(opts.dev.stat.st_mode)) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 27/38: gfs2-utils: README file improvements
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit f35e92436b1cb143495e31b676117c438d1b907d
Author: Andrew Price <anprice(a)redhat.com>
Date: Fri Jan 20 11:39:59 2017 +0000
gfs2-utils: README file improvements
Add some introductory text, split the info into sections, separate the
build requirements from the installation requirements and generally tidy
up.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
README | 72 ++++++++++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 50 insertions(+), 22 deletions(-)
diff --git a/README b/README
index d0a21c3..e8ab577 100644
--- a/README
+++ b/README
@@ -1,41 +1,69 @@
+gfs2-utils
+----------
-To build this source tree, you will need:
+This package contains the tools needed to create, check, manipulate and analyze
+gfs2 filesystems, along with important scripts required to support gfs2
+clusters.
- - automake
- - GNU make
- - GCC tool chain
+Build instructions
+------------------
-Plus the following libraries:
+The following development packages are required to build gfs2-utils:
- ncurses (for gfs2_edit)
- gettext
- bison
- flex
- zlib
- libblkid
- check (optional, enables the test suite)
+ o autoconf
+ o automake
+ o libtool
+ o GNU make
+ o ncurses
+ o gettext
+ o bison
+ o flex
+ o zlib
+ o libblkid
+ o check (optional, enables the test suite)
+
+The kernel header include/linux/gfs2-ondisk.h and its dependencies are also
+required.
To build gfs2-utils, run the following commands:
- ./autogen.sh
- ./configure
- make
+ $ ./autogen.sh
+ $ ./configure
+ $ make
+
+See ./configure --help for more build configuration options.
+
+Test Suite
+----------
+
+To run the test suite, use:
-To run the test suite:
+ $ make check
- make check
+See doc/README.tests for more details regarding the test suite.
+
+Installation
+------------
+
+gfs2-utils requires the following libraries:
+
+ o zlib
+ o ncurses
+ o libblkid
To install gfs2-utils, run:
- make install
+ # make install
+
+Support scripts
+---------------
The following scripts (located in gfs2/scripts) are used to complete
the userland portion of the gfs2 withdraw feature using uevents. They
will be installed by 'make install' to these directories by default:
- 82-gfs2-withdraw.rules in /usr/lib/udev/rules.d/
- gfs2_withdraw_helper in /usr/sbin/
+ 82-gfs2-withdraw.rules in /usr/lib/udev/rules.d/
+ gfs2_withdraw_helper in /usr/sbin/
-See also doc/README.contributing for details on submitting patches and
-doc/README.tests for more details regarding the test suite.
+See also doc/README.contributing for details on submitting patches.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 26/38: gfs2-utils: Rename README.build to README
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit 6b5b8fc64cd69d5adfb4082ae75608a063cbff35
Author: Andrew Price <anprice(a)redhat.com>
Date: Fri Jan 20 11:14:03 2017 +0000
gfs2-utils: Rename README.build to README
As there's only one README file in this directory it can just be called
README and contain the small amount of various info that needs to be
read. Removing the .build extension will also make Pagure render the
file as preformatted text.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
Makefile.am | 2 +-
README.build => README | 0
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 1c4f8ae..adeb56d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-EXTRA_DIST = autogen.sh README.build
+EXTRA_DIST = autogen.sh README
AUTOMAKE_OPTIONS = foreign
diff --git a/README.build b/README
similarity index 100%
rename from README.build
rename to README
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 25/38: gfs2-utils tests: Re-enable a fsck.gfs2 test
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit e9784779299cbd2e08951950bba16e80d080f753
Author: Andrew Price <anprice(a)redhat.com>
Date: Wed Jan 18 16:50:11 2017 +0000
gfs2-utils tests: Re-enable a fsck.gfs2 test
This test now passes.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
tests/fsck.at | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/fsck.at b/tests/fsck.at
index 5e49985..b9953fb 100644
--- a/tests/fsck.at
+++ b/tests/fsck.at
@@ -20,10 +20,10 @@ AT_KEYWORDS(fsck.gfs2 fsck)
GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock $GFS_TGT], [-r 0])
AT_CLEANUP
-#AT_SETUP([Fix bad resource group #1])
-#AT_KEYWORDS(fsck.gfs2 fsck)
-#GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock $GFS_TGT], [-r 1])
-#AT_CLEANUP
+AT_SETUP([Fix bad resource group #1])
+AT_KEYWORDS(fsck.gfs2 fsck)
+GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock $GFS_TGT], [-r 1])
+AT_CLEANUP
#AT_SETUP([Fix bad rindex entry #0])
#AT_KEYWORDS(fsck.gfs2 fsck)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 24/38: gfs2_edit savemeta: Save corrupt rgrp headers
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit 9868771ea383ecd3b46e6743b56e57ffb28c4c79
Author: Andrew Price <anprice(a)redhat.com>
Date: Wed Jan 18 15:14:57 2017 +0000
gfs2_edit savemeta: Save corrupt rgrp headers
Previously, savemeta used gfs2_rgrp_read() to read resource groups. This
includes a metadata check which fails the read if the resource groups
are corrupt. Since we want to save corruption in order to analyze it, we
need to read the rgrp headers without checking them. Use a new,
simplified rgrp_read() function for that.
Also avoid the effect of a similar metadata check in
get_gfs_struct_info() when saving rgrps.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index da24645..dee405b 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -417,7 +417,8 @@ static int save_bh(struct metafd *mfd, struct gfs2_buffer_head *savebh, uint64_t
because we want to know if the source inode is a system inode
not the block within the inode "blk". They may or may not
be the same thing. */
- if (get_gfs_struct_info(savebh, owner, blktype, &blklen) && !block_is_systemfile(owner))
+ if (get_gfs_struct_info(savebh, owner, blktype, &blklen) &&
+ !block_is_systemfile(owner) && owner != 0)
return 0; /* Not metadata, and not system file, so skip it */
/* No need to save trailing zeroes */
@@ -770,12 +771,41 @@ static void save_allocated(struct rgrp_tree *rgd, struct metafd *mfd)
free(ibuf);
}
+/* We don't use gfs2_rgrp_read() here as it checks for metadata sanity and we
+ want to save rgrp headers even if they're corrupt. */
+static int rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
+{
+ unsigned x, length = rgd->ri.ri_length;
+ struct gfs2_buffer_head **bhs;
+
+ if (length == 0 || gfs2_check_range(sdp, rgd->ri.ri_addr))
+ return -1;
+
+ bhs = calloc(length, sizeof(struct gfs2_buffer_head *));
+ if (bhs == NULL)
+ return -1;
+
+ if (breadm(sdp, bhs, length, rgd->ri.ri_addr)) {
+ free(bhs);
+ return -1;
+ }
+ for (x = 0; x < length; x++)
+ rgd->bits[x].bi_bh = bhs[x];
+
+ if (sdp->gfs1)
+ gfs_rgrp_in((struct gfs_rgrp *)&rgd->rg, rgd->bits[0].bi_bh);
+ else
+ gfs2_rgrp_in(&rgd->rg, rgd->bits[0].bi_bh);
+ free(bhs);
+ return 0;
+}
+
static void save_rgrp(struct metafd *mfd, struct rgrp_tree *rgd, int withcontents)
{
uint64_t addr = rgd->ri.ri_addr;
uint32_t i;
- if (gfs2_rgrp_read(&sbd, rgd))
+ if (rgrp_read(&sbd, rgd))
return;
log_debug("RG at %"PRIu64" (0x%"PRIx64") is %u long\n",
addr, addr, rgd->ri.ri_length);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 23/38: gfs2_edit savemeta: Split out the rgrp saving
code
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit b1539dd5e046ff30db7a0744bba2bcf96afb2934
Author: Andrew Price <anprice(a)redhat.com>
Date: Wed Jan 18 13:59:09 2017 +0000
gfs2_edit savemeta: Split out the rgrp saving code
Factor out the rgrp saving code into its own function to make it easier
to work with.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index f6b7ff0..da24645 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -770,6 +770,26 @@ static void save_allocated(struct rgrp_tree *rgd, struct metafd *mfd)
free(ibuf);
}
+static void save_rgrp(struct metafd *mfd, struct rgrp_tree *rgd, int withcontents)
+{
+ uint64_t addr = rgd->ri.ri_addr;
+ uint32_t i;
+
+ if (gfs2_rgrp_read(&sbd, rgd))
+ return;
+ log_debug("RG at %"PRIu64" (0x%"PRIx64") is %u long\n",
+ addr, addr, rgd->ri.ri_length);
+ /* Save the rg and bitmaps */
+ for (i = 0; i < rgd->ri.ri_length; i++) {
+ warm_fuzzy_stuff(rgd->ri.ri_addr + i, FALSE);
+ save_bh(mfd, rgd->bits[i].bi_bh, 0, NULL);
+ }
+ /* Save the other metadata: inodes, etc. if mode is not 'savergs' */
+ if (withcontents)
+ save_allocated(rgd, mfd);
+ gfs2_rgrp_relse(rgd);
+}
+
static int save_header(struct metafd *mfd, uint64_t fsbytes)
{
struct savemeta_header smh = {
@@ -878,25 +898,9 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
/* Walk through the resource groups saving everything within */
for (n = osi_first(&sbd.rgtree); n; n = osi_next(n)) {
struct rgrp_tree *rgd;
- unsigned i;
rgd = (struct rgrp_tree *)n;
- if (gfs2_rgrp_read(&sbd, rgd))
- continue;
- log_debug("RG at %lld (0x%llx) is %u long\n",
- (unsigned long long)rgd->ri.ri_addr,
- (unsigned long long)rgd->ri.ri_addr,
- rgd->ri.ri_length);
- /* Save off the rg and bitmaps */
- for (i = 0; i < rgd->ri.ri_length; i++) {
- warm_fuzzy_stuff(rgd->ri.ri_addr + i, FALSE);
- save_bh(&mfd, rgd->bits[i].bi_bh, 0, NULL);
- }
- /* Save off the other metadata: inodes, etc. if mode is not 'savergs' */
- if (saveoption != 2) {
- save_allocated(rgd, &mfd);
- }
- gfs2_rgrp_relse(rgd);
+ save_rgrp(&mfd, rgd, (saveoption != 2));
}
/* Clean up */
/* There may be a gap between end of file system and end of device */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years