Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=1cd2941694…
Commit: 1cd29416945e9d630003ae46b9138892a5c87a04
Parent: 78f88c8146354eeb9d34e6ec25f1a5c14ddd66c4
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 16:39:44 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 16:39:44 2016 +0000
gfs2_edit: Don't use the global block variable in savemeta
Replace it with local variables as savemeta doesn't use its existing
value.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index c376db4..17ad35d 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -828,26 +828,28 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
exit(1);
}
/* Save off the superblock */
- save_block(sbd.device_fd, &mfd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK / sbd.bsize, block);
+ save_block(sbd.device_fd, &mfd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK / sbd.bsize, 0);
/* If this is gfs1, save off the rindex because it's not
part of the file system as it is in gfs2. */
if (sbd.gfs1) {
+ uint64_t blk;
int j;
- block = sbd1->sb_rindex_di.no_addr;
- save_block(sbd.device_fd, &mfd, block, block);
- save_inode_data(&mfd, block);
+ blk = sbd1->sb_rindex_di.no_addr;
+ save_block(sbd.device_fd, &mfd, blk, blk);
+ save_inode_data(&mfd, blk);
/* In GFS1, journals aren't part of the RG space */
for (j = 0; j < journals_found; j++) {
log_debug("Saving journal #%d\n", j + 1);
- for (block = journal_blocks[j];
- block < journal_blocks[j] + gfs1_journal_size;
- block++)
- save_block(sbd.device_fd, &mfd, block, block);
+ for (blk = journal_blocks[j];
+ blk < journal_blocks[j] + gfs1_journal_size;
+ blk++)
+ save_block(sbd.device_fd, &mfd, blk, blk);
}
}
/* Walk through the resource groups saving everything within */
for (n = osi_first(&sbd.rgtree); n; n = osi_next(n)) {
+ uint64_t blk;
struct rgrp_tree *rgd;
rgd = (struct rgrp_tree *)n;
@@ -858,10 +860,10 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
(unsigned long long)rgd->ri.ri_addr,
rgd->ri.ri_length);
/* Save off the rg and bitmaps */
- for (block = rgd->ri.ri_addr;
- block < rgd->ri.ri_data0; block++) {
- warm_fuzzy_stuff(block, FALSE);
- save_block(sbd.device_fd, &mfd, block, block);
+ for (blk = rgd->ri.ri_addr;
+ blk < rgd->ri.ri_data0; blk++) {
+ warm_fuzzy_stuff(blk, FALSE);
+ save_block(sbd.device_fd, &mfd, blk, blk);
}
/* Save off the other metadata: inodes, etc. if mode is not 'savergs' */
if (saveoption != 2) {
@@ -872,8 +874,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
/* Clean up */
/* There may be a gap between end of file system and end of device */
/* so we tell the user that we've processed everything. */
- block = sbd.fssize;
- warm_fuzzy_stuff(block, TRUE);
+ warm_fuzzy_stuff(sbd.fssize, TRUE);
printf("\nMetadata saved to file %s ", mfd.filename);
if (mfd.gziplevel) {
printf("(gzipped, level %d).\n", mfd.gziplevel);
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=608c1231f5…
Commit: 608c1231f5b74f74bdc033746edacd0048c3a162
Parent: f4ffaffeb359ec4e8670b382ab4cdcf1344c18db
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 16:22:32 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 16:22:32 2016 +0000
gfs2_edit: Don't use the global block variable in get_gfs_struct_info
Accept the block's owner's address as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 1b3674c..2fc4815 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -196,14 +196,16 @@ static const char *anthropomorphize(unsigned long long inhuman_value)
/*
* get_gfs_struct_info - get block type and structure length
*
+ * @lbh - The block buffer to examine
+ * @owner - The block address of the parent structure
* @block_type - pointer to integer to hold the block type
- * @struct_length - pointer to integet to hold the structure length
+ * @gstruct_len - pointer to integer to hold the structure length
*
* returns: 0 if successful
* -1 if this isn't gfs metadata.
*/
-static int get_gfs_struct_info(struct gfs2_buffer_head *lbh, int *block_type,
- int *gstruct_len)
+static int get_gfs_struct_info(struct gfs2_buffer_head *lbh, uint64_t owner,
+ int *block_type, int *gstruct_len)
{
struct gfs2_meta_header mh;
struct gfs2_inode *inode;
@@ -240,7 +242,7 @@ static int get_gfs_struct_info(struct gfs2_buffer_head *lbh, int *block_type,
if (S_ISDIR(inode->i_di.di_mode) ||
(sbd.gfs1 && inode->i_di.__pad1 == GFS_FILE_DIR))
*gstruct_len = sbd.bsize;
- else if (!inode->i_di.di_height && !block_is_systemfile(block) &&
+ else if (!inode->i_di.di_height && !block_is_systemfile(owner) &&
!S_ISDIR(inode->i_di.di_mode))
*gstruct_len = sizeof(struct gfs2_dinode);
else
@@ -426,7 +428,7 @@ static int save_block(int fd, struct metafd *mfd, uint64_t blk, uint64_t owner)
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, &blktype, &blklen) &&
+ if (get_gfs_struct_info(savebh, owner, &blktype, &blklen) &&
!block_is_systemfile(owner)) {
brelse(savebh);
return 0; /* Not metadata, and not system file, so skip it */