From: Andrew Price Date: Thu, 6 Aug 2020 14:37:46 +0100 Subject: [Cluster-devel] [PATCH 11/32] libgfs2: No need to use gfs2_buffer_head in metapointer() In-Reply-To: <20200806133807.111280-1-anprice@redhat.com> References: <20200806133807.111280-1-anprice@redhat.com> Message-ID: <20200806133807.111280-12-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 Signed-off-by: Andrew Price --- gfs2/libgfs2/fs_ops.c | 6 +++--- gfs2/libgfs2/gfs1.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c index ee512f67..77648a16 100644 --- a/gfs2/libgfs2/fs_ops.c +++ b/gfs2/libgfs2/fs_ops.c @@ -15,14 +15,14 @@ #include "libgfs2.h" #include "rgrp.h" -static __inline__ uint64_t *metapointer(struct gfs2_buffer_head *bh, +static __inline__ uint64_t *metapointer(char *buf, unsigned int height, struct metapath *mp) { unsigned int head_size = (height > 0) ? sizeof(struct gfs2_meta_header) : sizeof(struct gfs2_dinode); - return ((uint64_t *)(bh->b_data + head_size)) + mp->mp_list[height]; + return ((uint64_t *)(buf + head_size)) + mp->mp_list[height]; } /* Detect directory is a stuffed inode */ @@ -447,7 +447,7 @@ void lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh, unsigned int height, struct metapath *mp, int create, int *new, uint64_t *block) { - uint64_t *ptr = metapointer(bh, height, mp); + uint64_t *ptr = metapointer(bh->b_data, height, mp); if (*ptr) { *block = be64_to_cpu(*ptr); diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c index 29e4f12d..da2a0804 100644 --- a/gfs2/libgfs2/gfs1.c +++ b/gfs2/libgfs2/gfs1.c @@ -25,13 +25,12 @@ static __inline__ int fs_is_jdata(struct gfs2_inode *ip) } static __inline__ uint64_t * -gfs1_metapointer(struct gfs2_buffer_head *bh, unsigned int height, - struct metapath *mp) +gfs1_metapointer(char *buf, unsigned int height, struct metapath *mp) { unsigned int head_size = (height > 0) ? sizeof(struct gfs_indirect) : sizeof(struct gfs_dinode); - return ((uint64_t *)(bh->b_data + head_size)) + mp->mp_list[height]; + return ((uint64_t *)(buf + head_size)) + mp->mp_list[height]; } int is_gfs_dir(struct gfs2_dinode *dinode) @@ -45,7 +44,7 @@ void gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh, unsigned int height, struct metapath *mp, int create, int *new, uint64_t *block) { - uint64_t *ptr = gfs1_metapointer(bh, height, mp); + uint64_t *ptr = gfs1_metapointer(bh->b_data, height, mp); if (*ptr) { *block = be64_to_cpu(*ptr); -- 2.26.2