This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit adf5305c6b5cc3cae3d273c401aa41a5e7a473c2
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed May 20 03:00:12 2020 +0100
libgfs2: Remove gfs2_buffer_head from lgfs2_gfs_inode_get()
Give lgfs2_gfs_inode_read() its own reading code for now. Removing bh's
from that will involve removing the i_bh field from gfs2_inode, which
has a lot of users.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/edit/savemeta.c | 4 ++--
gfs2/fsck/metawalk.c | 2 +-
gfs2/libgfs2/gfs1.c | 33 ++++++++++++++++++---------------
gfs2/libgfs2/libgfs2.h | 6 ++----
5 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 7de0f92..54a6ec1 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -867,7 +867,7 @@ static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head
*bh)
struct inode_block *fixdir;
int inode_was_gfs1;
- inode = lgfs2_gfs_inode_get(sbp, bh);
+ inode = lgfs2_gfs_inode_get(sbp, bh->b_data);
if (inode == NULL) {
log_crit(_("Error reading inode: %s\n"), strerror(errno));
return -1;
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 10e3bcc..cbecf28 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -303,7 +303,7 @@ static size_t di_save_len(struct gfs2_buffer_head *bh, uint64_t
owner)
size_t len;
if (sbd.gfs1)
- inode = lgfs2_gfs_inode_get(&sbd, bh);
+ inode = lgfs2_gfs_inode_get(&sbd, bh->b_data);
else
inode = lgfs2_inode_get(&sbd, bh);
@@ -724,7 +724,7 @@ static void save_inode_data(struct metafd *mfd, uint64_t iblk)
osi_list_init(&metalist[i]);
metabh = bread(&sbd, iblk);
if (sbd.gfs1) {
- inode = lgfs2_gfs_inode_get(&sbd, metabh);
+ inode = lgfs2_gfs_inode_get(&sbd, metabh->b_data);
} else {
inode = lgfs2_inode_get(&sbd, metabh);
}
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 265fa76..a425e88 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -292,7 +292,7 @@ struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp, struct
rgrp_tree *rgd,
return sysip;
if (sdp->gfs1)
- ip = lgfs2_gfs_inode_get(sdp, bh);
+ ip = lgfs2_gfs_inode_get(sdp, bh->b_data);
else
ip = lgfs2_inode_get(sdp, bh);
if (ip)
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index 7da2316..29e4f12 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -277,9 +277,7 @@ static void gfs_dinode_in(struct gfs_dinode *di, char *buf)
di->di_eattr = be64_to_cpu(str->di_eattr);
}
-static struct gfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp,
- struct gfs2_buffer_head *bh,
- uint64_t di_addr)
+static struct gfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp, char *buf, uint64_t
di_addr)
{
struct gfs_dinode gfs1_dinode;
struct gfs2_inode *ip;
@@ -288,13 +286,7 @@ static struct gfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp,
if (ip == NULL) {
return NULL;
}
-
- ip->bh_owned = 0;
- if (!bh) {
- bh = bread(sdp, di_addr);
- ip->bh_owned = 1;
- }
- gfs_dinode_in(&gfs1_dinode, bh->b_data);
+ gfs_dinode_in(&gfs1_dinode, buf);
memcpy(&ip->i_di.di_header, &gfs1_dinode.di_header,
sizeof(struct gfs2_meta_header));
memcpy(&ip->i_di.di_num, &gfs1_dinode.di_num,
@@ -319,20 +311,31 @@ static struct gfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp,
ip->i_di.di_depth = gfs1_dinode.di_depth;
ip->i_di.di_entries = gfs1_dinode.di_entries;
ip->i_di.di_eattr = gfs1_dinode.di_eattr;
- ip->i_bh = bh;
ip->i_sbd = sdp;
return ip;
}
-struct gfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp,
- struct gfs2_buffer_head *bh)
+struct gfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
{
- return __gfs_inode_get(sdp, bh, 0);
+ return __gfs_inode_get(sdp, buf, 0);
}
struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr)
{
- return __gfs_inode_get(sdp, NULL, di_addr);
+ struct gfs2_buffer_head *bh;
+ struct gfs2_inode *ip;
+
+ bh = bget(sdp, di_addr);
+ if (bh == NULL)
+ return NULL;
+ if (pread(sdp->device_fd, bh->b_data, sdp->bsize, di_addr * sdp->bsize) !=
sdp->bsize) {
+ brelse(bh);
+ return NULL;
+ }
+ ip = __gfs_inode_get(sdp, bh->b_data, di_addr);
+ ip->i_bh = bh;
+ ip->bh_owned = 1;
+ return ip;
}
/* ------------------------------------------------------------------------ */
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 59fb18e..a34e77a 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -639,10 +639,8 @@ extern void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock,
int *new,
extern int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset,
unsigned int size);
extern int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount, int quiet);
-extern struct gfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp,
- struct gfs2_buffer_head *bh);
-extern struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp,
- uint64_t di_addr);
+extern struct gfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf);
+extern struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr);
extern void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
extern void gfs_rgrp_in(struct gfs_rgrp *rg, const char *buf);
extern void gfs_rgrp_out(const struct gfs_rgrp *rg, char *buf);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.