From: Andrew Price Date: Thu, 4 Feb 2016 11:20:27 +0000 Subject: [Cluster-devel] [PATCH 16/23] gfs2_edit: Don't use the global block variable in get_gfs_struct_info In-Reply-To: <1454584834-32412-1-git-send-email-anprice@redhat.com> References: <1454584834-32412-1-git-send-email-anprice@redhat.com> Message-ID: <1454584834-32412-17-git-send-email-anprice@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Accept the block's owner's address as an argument instead. Signed-off-by: Andrew Price --- gfs2/edit/savemeta.c | 12 +++++++----- 1 file 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 */ -- 2.4.3