gfs2-utils: master - gfs2_edit: Don't use the global block variable
in save_indirect_blocks
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=4f726bc8...
Commit: 4f726bc88e633ec825c3a22ecead5834862dec53
Parent: ae21ffa7efaf24bd14e715545d5a6cce316b13e3
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 15:56:11 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 15:56:11 2016 +0000
gfs2_edit: Don't use the global block variable in save_indirect_blocks
Accept the block's owner's address as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 33d618a..7c7e504 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -495,7 +495,7 @@ static void save_ea_block(struct metafd *mfd, struct gfs2_buffer_head *metabh)
* save_indirect_blocks - save all indirect blocks for the given buffer
*/
static void save_indirect_blocks(struct metafd *mfd, osi_list_t *cur_list,
- struct gfs2_buffer_head *mybh, int height, int hgt)
+ struct gfs2_buffer_head *mybh, uint64_t owner, int height, int hgt)
{
uint64_t old_block = 0, indir_block;
uint64_t *ptr;
@@ -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, block);
+ blktype = save_block(sbd.device_fd, mfd, indir_block, owner);
if (blktype == GFS2_METATYPE_EA) {
nbh = bread(&sbd, indir_block);
save_ea_block(mfd, nbh);
@@ -589,7 +589,7 @@ static void save_inode_data(struct metafd *mfd)
mybh = osi_list_entry(tmp, struct gfs2_buffer_head,
b_altlist);
warm_fuzzy_stuff(block, FALSE);
- save_indirect_blocks(mfd, cur_list, mybh,
+ save_indirect_blocks(mfd, cur_list, mybh, block,
height, i);
} /* for blocks at that height */
} /* for height */
@@ -641,7 +641,7 @@ static void save_inode_data(struct metafd *mfd)
save_ea_block(mfd, lbh);
else if (mh.mh_magic == GFS2_MAGIC &&
mh.mh_type == GFS2_METATYPE_IN)
- save_indirect_blocks(mfd, cur_list, lbh, 2, 2);
+ save_indirect_blocks(mfd, cur_list, lbh, block, 2, 2);
else {
if (mh.mh_magic == GFS2_MAGIC) /* if it's metadata */
save_block(sbd.device_fd, mfd,
8 years, 2 months
gfs2-utils: master - gfs2_edit: Don't use the global block variable
in save_block
by Andrew Price
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) {
8 years, 2 months
gfs2-utils: master - gfs2_edit: Only declare the block variable where
needed
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=5686cfa1...
Commit: 5686cfa1e20cb168678450da091e0ef912c611dc
Parent: 785a372e99344cf15cbd9e6d696b7c767624c951
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 15:21:31 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 15:21:31 2016 +0000
gfs2_edit: Only declare the block variable where needed
This will help in removing it.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/extended.c | 2 ++
gfs2/edit/hexedit.c | 1 +
gfs2/edit/hexedit.h | 1 -
gfs2/edit/journal.c | 2 ++
gfs2/edit/savemeta.c | 2 ++
5 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 7a517bf..e804853 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -27,6 +27,8 @@
#include "extended.h"
#include "gfs2hex.h"
+extern uint64_t block;
+
static void print_block_details(struct iinfo *ind, int level, int cur_height,
int pndx, uint64_t file_offset);
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 12deb13..f732b96 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -45,6 +45,7 @@ int details = 0;
long int gziplevel = 9;
static int termcols;
char *device = NULL;
+extern uint64_t block;
/* ------------------------------------------------------------------------- */
/* erase - clear the screen */
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index ab4b41b..1dd9965 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -29,7 +29,6 @@ enum dsp_mode { HEX_MODE = 0, GFS2_MODE = 1, EXTENDED_MODE = 2, INIT_MODE = 3 };
extern const char *mtypes[];
extern struct gfs2_sb sb;
-extern uint64_t block;
extern int blockhist;
extern int edit_mode;
extern int line;
diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c
index 80c8738..ff0c6df 100644
--- a/gfs2/edit/journal.c
+++ b/gfs2/edit/journal.c
@@ -28,6 +28,8 @@
#include "gfs2hex.h"
#include "journal.h"
+extern uint64_t block;
+
/**
* find_journal_block - figure out where a journal starts, given the name
* Returns: journal block number, changes j_size to the journal size
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 157a83b..2d001e9 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -27,6 +27,8 @@
#include "hexedit.h"
#include "libgfs2.h"
+extern uint64_t block;
+
#define DFT_SAVE_FILE "/tmp/gfsmeta.XXXXXX"
#define MAX_JOURNALS_SAVED 256
8 years, 2 months
gfs2-utils: master - gfs2_edit: Don't use the global block variable
in block_is_journals
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=785a372e...
Commit: 785a372e99344cf15cbd9e6d696b7c767624c951
Parent: 66b2ef1733727a7fed601392f025d706e9b0e620
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 15:18:42 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 15:18:42 2016 +0000
gfs2_edit: Don't use the global block variable in block_is_journals
Accept it as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/extended.c | 2 +-
gfs2/edit/hexedit.c | 2 +-
gfs2/edit/hexedit.h | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index ced2412..7a517bf 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -662,7 +662,7 @@ int display_extended(void)
parse_rindex(tmp_inode, TRUE);
inode_put(&tmp_inode);
brelse(tmp_bh);
- } else if (block_is_journals()) {
+ } else if (block_is_journals(block)) {
if (sbd.gfs1)
block = sbd1->sb_jindex_di.no_addr;
else
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index b4123a1..12deb13 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -934,7 +934,7 @@ static int block_has_extended_info(void)
if (has_indirect_blocks() ||
block_is_rindex(block) ||
block_is_rgtree(block) ||
- block_is_journals() ||
+ block_is_journals(block) ||
block_is_jindex(block) ||
block_is_inum_file(block) ||
block_is_statfs_file(block) ||
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 1f97631..ab4b41b 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -121,9 +121,9 @@ static inline int block_is_rgtree(uint64_t blk)
return FALSE;
}
-static inline int block_is_journals(void)
+static inline int block_is_journals(uint64_t blk)
{
- if (block == JOURNALS_DUMMY_BLOCK)
+ if (blk == JOURNALS_DUMMY_BLOCK)
return TRUE;
return FALSE;
}
8 years, 2 months
gfs2-utils: master - gfs2_edit: Don't use the global block variable
in block_is_rgtree
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=66b2ef17...
Commit: 66b2ef1733727a7fed601392f025d706e9b0e620
Parent: 3e0b661752347602cfbcd7efcb07d3fab052ee4c
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 15:16:57 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 15:16:57 2016 +0000
gfs2_edit: Don't use the global block variable in block_is_rgtree
Accept it as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/extended.c | 2 +-
gfs2/edit/hexedit.c | 2 +-
gfs2/edit/hexedit.h | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index a8a71e7..ced2412 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -673,7 +673,7 @@ int display_extended(void)
return -1;
else if (display_indirect(indirect, indirect_blocks, 0, 0) == 0)
return -1;
- else if (block_is_rgtree()) {
+ else if (block_is_rgtree(block)) {
if (sbd.gfs1)
tmp_bh = bread(&sbd, sbd1->sb_rindex_di.no_addr);
else
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 981c02c..b4123a1 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -933,7 +933,7 @@ static int block_has_extended_info(void)
{
if (has_indirect_blocks() ||
block_is_rindex(block) ||
- block_is_rgtree() ||
+ block_is_rgtree(block) ||
block_is_journals() ||
block_is_jindex(block) ||
block_is_inum_file(block) ||
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index f1f7667..1f97631 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -114,9 +114,9 @@ extern enum dsp_mode dmode;
/* special case meant to parse the rindex and follow the */
/* blocks to the real rgs. */
/* ------------------------------------------------------------------------ */
-static inline int block_is_rgtree(void)
+static inline int block_is_rgtree(uint64_t blk)
{
- if (block == RGLIST_DUMMY_BLOCK)
+ if (blk == RGLIST_DUMMY_BLOCK)
return TRUE;
return FALSE;
}
8 years, 2 months
gfs2-utils: master - gfs2_edit: Don't use the global block variable
in block_is_systemfile
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=3e0b6617...
Commit: 3e0b661752347602cfbcd7efcb07d3fab052ee4c
Parent: 6ce6f2b7d7fadf2bb2ba7f864fcdfc2bd7e323e1
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 15:09:43 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 15:09:43 2016 +0000
gfs2_edit: Don't use the global block variable in block_is_systemfile
Accept it as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 1899d9a..157a83b 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -164,12 +164,12 @@ static int init_per_node_lookup(void)
return 0;
}
-static int block_is_systemfile(void)
+static int block_is_systemfile(uint64_t blk)
{
- return block_is_jindex(block) || block_is_inum_file(block) ||
- block_is_statfs_file(block) || block_is_quota_file(block) ||
- block_is_rindex(block) || block_is_a_journal(block) ||
- block_is_per_node(block) || block_is_in_per_node(block);
+ return block_is_jindex(blk) || block_is_inum_file(blk) ||
+ block_is_statfs_file(blk) || block_is_quota_file(blk) ||
+ block_is_rindex(blk) || block_is_a_journal(blk) ||
+ block_is_per_node(blk) || block_is_in_per_node(blk);
}
/**
@@ -238,7 +238,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() &&
+ else if (!inode->i_di.di_height && !block_is_systemfile(block) &&
!S_ISDIR(inode->i_di.di_mode))
*gstruct_len = sizeof(struct gfs2_dinode);
else
@@ -425,7 +425,7 @@ static int save_block(int fd, struct metafd *mfd, uint64_t blk)
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_is_systemfile(block)) {
brelse(savebh);
return 0; /* Not metadata, and not system file, so skip it */
}
@@ -576,7 +576,7 @@ static void save_inode_data(struct metafd *mfd)
(sbd.gfs1 && inode->i_di.__pad1 == GFS_FILE_DIR)))
height++;
else if (height && !(inode->i_di.di_flags & GFS2_DIF_SYSTEM) &&
- !block_is_systemfile() && !S_ISDIR(inode->i_di.di_mode))
+ !block_is_systemfile(block) && !S_ISDIR(inode->i_di.di_mode))
height--;
osi_list_add(&metabh->b_altlist, &metalist[0]);
for (i = 1; i <= height; i++){
8 years, 2 months
gfs2-utils: master - gfs2_edit: Don't use the global block variable
in block_is_per_node
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=6ce6f2b7...
Commit: 6ce6f2b7d7fadf2bb2ba7f864fcdfc2bd7e323e1
Parent: f7d2b1c56b4bd1299714ca2034f7d394019da477
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 15:05:14 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 15:05:14 2016 +0000
gfs2_edit: Don't use the global block variable in block_is_per_node
Accept it as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/hexedit.c | 7 ++-----
gfs2/edit/hexedit.h | 2 +-
gfs2/edit/savemeta.c | 2 +-
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 7c85ca8..981c02c 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -919,12 +919,9 @@ int block_is_quota_file(uint64_t blk)
return FALSE;
}
-/* ------------------------------------------------------------------------ */
-/* block_is_per_node */
-/* ------------------------------------------------------------------------ */
-int block_is_per_node(void)
+int block_is_per_node(uint64_t blk)
{
- if (!sbd.gfs1 && block == masterblock("per_node"))
+ if (!sbd.gfs1 && blk == masterblock("per_node"))
return TRUE;
return FALSE;
}
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 9607523..f1f7667 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -223,7 +223,7 @@ extern int block_is_rindex(uint64_t blk);
extern int block_is_inum_file(uint64_t blk);
extern int block_is_statfs_file(uint64_t blk);
extern int block_is_quota_file(uint64_t blk);
-extern int block_is_per_node(void);
+extern int block_is_per_node(uint64_t blk);
extern int display_block_type(int from_restore);
extern void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
extern void gfs_log_header_in(struct gfs_log_header *head,
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 4483e4e..1899d9a 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -169,7 +169,7 @@ static int block_is_systemfile(void)
return block_is_jindex(block) || block_is_inum_file(block) ||
block_is_statfs_file(block) || block_is_quota_file(block) ||
block_is_rindex(block) || block_is_a_journal(block) ||
- block_is_per_node() || block_is_in_per_node(block);
+ block_is_per_node(block) || block_is_in_per_node(block);
}
/**
8 years, 2 months
gfs2-utils: master - gfs2_edit: Don't use global block variable in
block_is_rindex
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=f7d2b1c5...
Commit: f7d2b1c56b4bd1299714ca2034f7d394019da477
Parent: 6479aa78befbca3998b6f3d1decddf67285d353e
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 15:02:29 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 15:02:29 2016 +0000
gfs2_edit: Don't use global block variable in block_is_rindex
Accept it as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/extended.c | 2 +-
gfs2/edit/hexedit.c | 13 +++++--------
gfs2/edit/hexedit.h | 2 +-
gfs2/edit/savemeta.c | 2 +-
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index db2c546..a8a71e7 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -654,7 +654,7 @@ int display_extended(void)
dsplines = termlines - line - 1;
/* Display any indirect pointers that we have. */
- if (block_is_rindex()) {
+ if (block_is_rindex(block)) {
tmp_bh = bread(&sbd, block);
tmp_inode = lgfs2_inode_get(&sbd, tmp_bh);
if (tmp_inode == NULL)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 3ce0987..7c85ca8 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -879,13 +879,10 @@ int has_indirect_blocks(void)
return FALSE;
}
-/* ------------------------------------------------------------------------ */
-/* block_is_rindex */
-/* ------------------------------------------------------------------------ */
-int block_is_rindex(void)
+int block_is_rindex(uint64_t blk)
{
- if ((sbd.gfs1 && block == sbd1->sb_rindex_di.no_addr) ||
- (block == masterblock("rindex")))
+ if ((sbd.gfs1 && blk == sbd1->sb_rindex_di.no_addr) ||
+ (blk == masterblock("rindex")))
return TRUE;
return FALSE;
}
@@ -938,7 +935,7 @@ int block_is_per_node(void)
static int block_has_extended_info(void)
{
if (has_indirect_blocks() ||
- block_is_rindex() ||
+ block_is_rindex(block) ||
block_is_rgtree() ||
block_is_journals() ||
block_is_jindex(block) ||
@@ -1187,7 +1184,7 @@ static void push_block(uint64_t blk)
blockstack[bhst].lines_per_row[i] = lines_per_row[i];
}
blockstack[bhst].gfs2_struct_type = gfs2_struct_type;
- if (edit_row[dmode] >= 0 && !block_is_rindex())
+ if (edit_row[dmode] >= 0 && !block_is_rindex(block))
memcpy(&blockstack[bhst].mp,
&indirect->ii[edit_row[dmode]].mp,
sizeof(struct metapath));
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index b488262..9607523 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -219,7 +219,7 @@ void die(const char *fmt, ...)
} while (0)
extern int block_is_jindex(uint64_t blk);
-extern int block_is_rindex(void);
+extern int block_is_rindex(uint64_t blk);
extern int block_is_inum_file(uint64_t blk);
extern int block_is_statfs_file(uint64_t blk);
extern int block_is_quota_file(uint64_t blk);
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 079677e..4483e4e 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -168,7 +168,7 @@ static int block_is_systemfile(void)
{
return block_is_jindex(block) || block_is_inum_file(block) ||
block_is_statfs_file(block) || block_is_quota_file(block) ||
- block_is_rindex() || block_is_a_journal(block) ||
+ block_is_rindex(block) || block_is_a_journal(block) ||
block_is_per_node() || block_is_in_per_node(block);
}
8 years, 2 months
gfs2-utils: master - gfs2_edit: Don't use global block variable in
block_is_quota_file
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=6479aa78...
Commit: 6479aa78befbca3998b6f3d1decddf67285d353e
Parent: 10d4d4963917055d0085652403503b793571c533
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 15:00:03 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 15:00:03 2016 +0000
gfs2_edit: Don't use global block variable in block_is_quota_file
Accept it as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/extended.c | 2 +-
gfs2/edit/hexedit.c | 11 ++++-------
gfs2/edit/hexedit.h | 2 +-
gfs2/edit/savemeta.c | 2 +-
4 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 3d24845..db2c546 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -711,7 +711,7 @@ int display_extended(void)
inode_put(&tmp_inode);
brelse(tmp_bh);
}
- else if (block_is_quota_file()) {
+ else if (block_is_quota_file(block)) {
tmp_bh = bread(&sbd, block);
tmp_inode = lgfs2_inode_get(&sbd, tmp_bh);
if (tmp_inode == NULL)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 5a212dd..3ce0987 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -913,14 +913,11 @@ int block_is_statfs_file(uint64_t blk)
return FALSE;
}
-/* ------------------------------------------------------------------------ */
-/* block_is_quota_file */
-/* ------------------------------------------------------------------------ */
-int block_is_quota_file(void)
+int block_is_quota_file(uint64_t blk)
{
- if (sbd.gfs1 && block == gfs1_quota_di.no_addr)
+ if (sbd.gfs1 && blk == gfs1_quota_di.no_addr)
return TRUE;
- if (!sbd.gfs1 && block == masterblock("quota"))
+ if (!sbd.gfs1 && blk == masterblock("quota"))
return TRUE;
return FALSE;
}
@@ -947,7 +944,7 @@ static int block_has_extended_info(void)
block_is_jindex(block) ||
block_is_inum_file(block) ||
block_is_statfs_file(block) ||
- block_is_quota_file())
+ block_is_quota_file(block))
return TRUE;
return FALSE;
}
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index f959d31..b488262 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -222,7 +222,7 @@ extern int block_is_jindex(uint64_t blk);
extern int block_is_rindex(void);
extern int block_is_inum_file(uint64_t blk);
extern int block_is_statfs_file(uint64_t blk);
-extern int block_is_quota_file(void);
+extern int block_is_quota_file(uint64_t blk);
extern int block_is_per_node(void);
extern int display_block_type(int from_restore);
extern void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index c659cbc..079677e 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -167,7 +167,7 @@ static int init_per_node_lookup(void)
static int block_is_systemfile(void)
{
return block_is_jindex(block) || block_is_inum_file(block) ||
- block_is_statfs_file(block) || block_is_quota_file() ||
+ block_is_statfs_file(block) || block_is_quota_file(block) ||
block_is_rindex() || block_is_a_journal(block) ||
block_is_per_node() || block_is_in_per_node(block);
}
8 years, 2 months
gfs2-utils: master - gfs2_edit: Don't use global block variable in
block_is_statfs_file
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=10d4d496...
Commit: 10d4d4963917055d0085652403503b793571c533
Parent: 3c43071340165032de2aeab6ba1be2688b7dd368
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Feb 3 14:57:57 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Feb 3 14:57:57 2016 +0000
gfs2_edit: Don't use global block variable in block_is_statfs_file
Accept it as an argument instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/extended.c | 2 +-
gfs2/edit/hexedit.c | 11 ++++-------
gfs2/edit/hexedit.h | 2 +-
gfs2/edit/savemeta.c | 2 +-
4 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 8c7244b..3d24845 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -702,7 +702,7 @@ int display_extended(void)
inode_put(&tmp_inode);
brelse(tmp_bh);
}
- else if (block_is_statfs_file()) {
+ else if (block_is_statfs_file(block)) {
tmp_bh = bread(&sbd, block);
tmp_inode = lgfs2_inode_get(&sbd, tmp_bh);
if (tmp_inode == NULL)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 6125d04..5a212dd 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -904,14 +904,11 @@ int block_is_inum_file(uint64_t blk)
return FALSE;
}
-/* ------------------------------------------------------------------------ */
-/* block_is_statfs_file */
-/* ------------------------------------------------------------------------ */
-int block_is_statfs_file(void)
+int block_is_statfs_file(uint64_t blk)
{
- if (sbd.gfs1 && block == gfs1_license_di.no_addr)
+ if (sbd.gfs1 && blk == gfs1_license_di.no_addr)
return TRUE;
- if (!sbd.gfs1 && block == masterblock("statfs"))
+ if (!sbd.gfs1 && blk == masterblock("statfs"))
return TRUE;
return FALSE;
}
@@ -949,7 +946,7 @@ static int block_has_extended_info(void)
block_is_journals() ||
block_is_jindex(block) ||
block_is_inum_file(block) ||
- block_is_statfs_file() ||
+ block_is_statfs_file(block) ||
block_is_quota_file())
return TRUE;
return FALSE;
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index f229ed4..f959d31 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -221,7 +221,7 @@ void die(const char *fmt, ...)
extern int block_is_jindex(uint64_t blk);
extern int block_is_rindex(void);
extern int block_is_inum_file(uint64_t blk);
-extern int block_is_statfs_file(void);
+extern int block_is_statfs_file(uint64_t blk);
extern int block_is_quota_file(void);
extern int block_is_per_node(void);
extern int display_block_type(int from_restore);
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index ab4fe0e..c659cbc 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -167,7 +167,7 @@ static int init_per_node_lookup(void)
static int block_is_systemfile(void)
{
return block_is_jindex(block) || block_is_inum_file(block) ||
- block_is_statfs_file() || block_is_quota_file() ||
+ block_is_statfs_file(block) || block_is_quota_file() ||
block_is_rindex() || block_is_a_journal(block) ||
block_is_per_node() || block_is_in_per_node(block);
}
8 years, 2 months