Gitweb:
http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=ae21ffa7...
Commit: ae21ffa7efaf24bd14e715545d5a6cce316b13e3
Parent: 5686cfa1e20cb168678450da091e0ef912c611dc
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 15:46:26 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 15:46:26 2016 +0000
gfs2_edit: Don't use the global block variable in save_block
Accept the block's owner's address as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 2d001e9..33d618a 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -405,7 +405,7 @@ static int savemetaclose(struct metafd *mfd)
return close(mfd->fd);
}
-static int save_block(int fd, struct metafd *mfd, uint64_t blk)
+static int save_block(int fd, struct metafd *mfd, uint64_t blk, uint64_t owner)
{
int blktype, blklen;
size_t outsz;
@@ -416,18 +416,18 @@ static int save_block(int fd, struct metafd *mfd, uint64_t blk)
fprintf(stderr, "\nWarning: bad block pointer '0x%llx' "
"ignored in block (block %llu (0x%llx))",
(unsigned long long)blk,
- (unsigned long long)block, (unsigned long long)block);
+ (unsigned long long)owner, (unsigned long long)owner);
return 0;
}
savebh = bread(&sbd, blk);
/* If this isn't metadata and isn't a system file, we don't want it.
- Note that we're checking "block" here rather than blk. That's
- because we want to know if the source inode's "block" is a system
- inode, not the block within the inode "blk". They may or may not
+ Note that we're checking "owner" here rather than blk. That's
+ 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) &&
- !block_is_systemfile(block)) {
+ !block_is_systemfile(owner)) {
brelse(savebh);
return 0; /* Not metadata, and not system file, so skip it */
}
@@ -484,7 +484,7 @@ static void save_ea_block(struct metafd *mfd, struct gfs2_buffer_head
*metabh)
b = (uint64_t *)(metabh->b_data);
b += charoff + i;
blk = be64_to_cpu(*b);
- save_block(sbd.device_fd, mfd, blk);
+ save_block(sbd.device_fd, mfd, blk, block);
}
if (!ea.ea_rec_len)
break;
@@ -514,7 +514,7 @@ static void save_indirect_blocks(struct metafd *mfd, osi_list_t
*cur_list,
if (indir_block == old_block)
continue;
old_block = indir_block;
- blktype = save_block(sbd.device_fd, mfd, indir_block);
+ blktype = save_block(sbd.device_fd, mfd, indir_block, block);
if (blktype == GFS2_METATYPE_EA) {
nbh = bread(&sbd, indir_block);
save_ea_block(mfd, nbh);
@@ -625,7 +625,7 @@ static void save_inode_data(struct metafd *mfd)
mybh = bread(&sbd, leaf_no);
warm_fuzzy_stuff(block, FALSE);
if (gfs2_check_meta(mybh, GFS2_METATYPE_LF) == 0)
- save_block(sbd.device_fd, mfd, leaf_no);
+ save_block(sbd.device_fd, mfd, leaf_no, block);
brelse(mybh);
}
}
@@ -634,7 +634,7 @@ static void save_inode_data(struct metafd *mfd)
struct gfs2_buffer_head *lbh;
lbh = bread(&sbd, inode->i_di.di_eattr);
- save_block(sbd.device_fd, mfd, inode->i_di.di_eattr);
+ save_block(sbd.device_fd, mfd, inode->i_di.di_eattr, block);
gfs2_meta_header_in(&mh, lbh);
if (mh.mh_magic == GFS2_MAGIC &&
mh.mh_type == GFS2_METATYPE_EA)
@@ -645,7 +645,7 @@ static void save_inode_data(struct metafd *mfd)
else {
if (mh.mh_magic == GFS2_MAGIC) /* if it's metadata */
save_block(sbd.device_fd, mfd,
- inode->i_di.di_eattr);
+ inode->i_di.di_eattr, block);
fprintf(stderr,
"\nWarning: corrupt extended "
"attribute at block %llu (0x%llx) "
@@ -721,7 +721,7 @@ static void save_allocated(struct rgrp_tree *rgd, struct metafd *mfd)
for (j = 0; j < m; j++) {
block = ibuf[j];
warm_fuzzy_stuff(block, FALSE);
- blktype = save_block(sbd.device_fd, mfd, block);
+ blktype = save_block(sbd.device_fd, mfd, block, block);
if (blktype == GFS2_METATYPE_DI)
save_inode_data(mfd);
}
@@ -733,7 +733,7 @@ static void save_allocated(struct rgrp_tree *rgd, struct metafd *mfd)
* If we don't, we may run into metadata allocation issues. */
m = lgfs2_bm_scan(rgd, i, ibuf, GFS2_BLKST_UNLINKED);
for (j = 0; j < m; j++) {
- save_block(sbd.device_fd, mfd, block);
+ save_block(sbd.device_fd, mfd, block, block);
}
}
free(ibuf);
@@ -825,14 +825,14 @@ 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);
+ save_block(sbd.device_fd, &mfd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK / sbd.bsize,
block);
/* 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) {
int j;
block = sbd1->sb_rindex_di.no_addr;
- save_block(sbd.device_fd, &mfd, block);
+ save_block(sbd.device_fd, &mfd, block, block);
save_inode_data(&mfd);
/* In GFS1, journals aren't part of the RG space */
for (j = 0; j < journals_found; j++) {
@@ -840,7 +840,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
for (block = journal_blocks[j];
block < journal_blocks[j] + gfs1_journal_size;
block++)
- save_block(sbd.device_fd, &mfd, block);
+ save_block(sbd.device_fd, &mfd, block, block);
}
}
/* Walk through the resource groups saving everything within */
@@ -858,7 +858,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
for (block = rgd->ri.ri_addr;
block < rgd->ri.ri_data0; block++) {
warm_fuzzy_stuff(block, FALSE);
- save_block(sbd.device_fd, &mfd, block);
+ save_block(sbd.device_fd, &mfd, block, block);
}
/* Save off the other metadata: inodes, etc. if mode is not 'savergs' */
if (saveoption != 2) {