From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 14/20] libgfs2: Don't use buffer_heads in gfs2_leaf_{in, out}
Date: Mon, 5 Mar 2018 18:25:43 +0000 [thread overview]
Message-ID: <20180305182549.17817-15-anprice@redhat.com> (raw)
In-Reply-To: <20180305182549.17817-1-anprice@redhat.com>
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/edit/gfs2hex.c | 8 +++-----
gfs2/edit/savemeta.c | 2 +-
gfs2/fsck/metawalk.c | 10 ++++++----
gfs2/fsck/pass2.c | 6 +++---
gfs2/libgfs2/libgfs2.h | 4 ++--
gfs2/libgfs2/ondisk.c | 13 ++++++-------
7 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index d2b29f34..eac907cd 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1303,7 +1303,7 @@ static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip
(unsigned long long)leaf_block);
break;
}
- gfs2_leaf_in(&leaf, bh_leaf); /* buffer to structure */
+ gfs2_leaf_in(&leaf, bh_leaf->b_data);
error = process_dirent_info(dip, sbp, bh_leaf, leaf.lf_entries, dentmod);
bmodified(bh_leaf);
brelse(bh_leaf);
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 1a12e05e..c1aa81a8 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -298,7 +298,7 @@ void do_dinode_extended(struct gfs2_dinode *dine, struct gfs2_buffer_head *lbh)
if (last >= max_block)
break;
tmp_bh = bread(&sbd, last);
- gfs2_leaf_in(&leaf, tmp_bh);
+ gfs2_leaf_in(&leaf, tmp_bh->b_data);
indirect->ii[indirect_blocks].dirents = 0;
for (direntcount = 0, bufoffset = sizeof(struct gfs2_leaf);
bufoffset < sbd.bsize;
@@ -325,12 +325,10 @@ uint64_t do_leaf_extended(char *dlebuf, struct iinfo *indir)
{
int x, i;
struct gfs2_dirent de;
- struct gfs2_buffer_head tbh; /* kludge */
x = 0;
memset(indir, 0, sizeof(*indir));
- tbh.b_data = dlebuf;
- gfs2_leaf_in(&indir->ii[0].lf, &tbh);
+ gfs2_leaf_in(&indir->ii[0].lf, dlebuf);
/* Directory Entries: */
for (i = sizeof(struct gfs2_leaf); i < sbd.bsize;
i += de.de_rec_len) {
@@ -519,7 +517,7 @@ int display_gfs2(struct gfs2_buffer_head *dbh)
break;
case GFS2_METATYPE_LF:
- gfs2_leaf_in(&lf, dbh);
+ gfs2_leaf_in(&lf, dbh->b_data);
gfs2_leaf_print(&lf);
break;
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 6d87f33d..25fd7bc1 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -574,7 +574,7 @@ static int save_leaf_chain(struct metafd *mfd, struct gfs2_sbd *sdp, uint64_t bl
return ret;
}
}
- gfs2_leaf_in(&leaf, bh);
+ gfs2_leaf_in(&leaf, bh->b_data);
brelse(bh);
blk = leaf.lf_next;
} while (leaf.lf_next != 0);
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 78c5b8aa..127edaa2 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -583,12 +583,13 @@ int check_leaf(struct gfs2_inode *ip, int lindex, struct metawalk_fxns *pass,
to use cpu_to_be32(), but we should check for incorrect values and
replace them with the correct value. */
- gfs2_leaf_in(leaf, lbh);
+ gfs2_leaf_in(leaf, lbh->b_data);
if (leaf->lf_dirent_format == (GFS2_FORMAT_DE << 16)) {
log_debug( _("incorrect lf_dirent_format@leaf #%" PRIu64
"\n"), *leaf_no);
leaf->lf_dirent_format = GFS2_FORMAT_DE;
- gfs2_leaf_out(leaf, lbh);
+ gfs2_leaf_out(leaf, lbh->b_data);
+ bmodified(lbh);
log_debug( _("Fixing lf_dirent_format.\n"));
}
@@ -623,7 +624,7 @@ int check_leaf(struct gfs2_inode *ip, int lindex, struct metawalk_fxns *pass,
changed it. */
brelse(lbh);
lbh = bread(sdp, *leaf_no);
- gfs2_leaf_in(leaf, lbh);
+ gfs2_leaf_in(leaf, lbh->b_data);
if (count != leaf->lf_entries) {
log_err( _("Leaf %llu (0x%llx) entry count in "
"directory %llu (0x%llx) does not match "
@@ -635,7 +636,8 @@ int check_leaf(struct gfs2_inode *ip, int lindex, struct metawalk_fxns *pass,
leaf->lf_entries, count);
if (query( _("Update leaf entry count? (y/n) "))) {
leaf->lf_entries = count;
- gfs2_leaf_out(leaf, lbh);
+ gfs2_leaf_out(leaf, lbh->b_data);
+ bmodified(lbh);
log_warn( _("Leaf entry count updated\n"));
} else
log_err( _("Leaf entry count left in "
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index abc2b960..763e39a9 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -1496,7 +1496,7 @@ static int fix_hashtable(struct gfs2_inode *ip, uint64_t *tbl, unsigned hsize,
new_leaf_blk = find_free_blk(ip->i_sbd);
dir_split_leaf(ip, lindex, leafblk, lbh);
/* re-read the leaf to pick up dir_split_leaf's changes */
- gfs2_leaf_in(&leaf, lbh);
+ gfs2_leaf_in(&leaf, lbh->b_data);
*proper_len = 1 << (ip->i_di.di_depth - leaf.lf_depth);
log_err(_("Leaf block %llu (0x%llx) was split from length "
"%d to %d\n"), (unsigned long long)leafblk,
@@ -1793,7 +1793,7 @@ static int check_hash_tbl(struct gfs2_inode *ip, uint64_t *tbl,
(unsigned long long)leafblk,
proper_len, proper_len);
lbh = bread(ip->i_sbd, leafblk);
- gfs2_leaf_in(&leaf, lbh);
+ gfs2_leaf_in(&leaf, lbh->b_data);
if (gfs2_check_meta(lbh, GFS2_METATYPE_LF) ||
leaf.lf_depth > ip->i_di.di_depth)
leaf.lf_depth = factor;
@@ -1833,7 +1833,7 @@ static int check_hash_tbl(struct gfs2_inode *ip, uint64_t *tbl,
/* Now we have to determine if the hash table is
corrupt, or if the leaf has the wrong depth. */
lbh = bread(ip->i_sbd, leafblk);
- gfs2_leaf_in(&leaf, lbh);
+ gfs2_leaf_in(&leaf, lbh->b_data);
brelse(lbh);
/* Calculate the expected pointer count based on the
leaf depth. */
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 7b2671b5..71b4e5e8 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -735,8 +735,8 @@ extern void gfs2_dinode_in(struct gfs2_dinode *di, char *buf);
extern void gfs2_dinode_out(struct gfs2_dinode *di, char *buf);
extern void gfs2_dirent_in(struct gfs2_dirent *de, char *buf);
extern void gfs2_dirent_out(struct gfs2_dirent *de, char *buf);
-extern void gfs2_leaf_in(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh);
-extern void gfs2_leaf_out(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh);
+extern void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf);
+extern void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf);
extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf);
extern void gfs2_log_header_v1_in(struct gfs2_log_header *lh, struct gfs2_buffer_head *bh);
extern void gfs2_log_header_in(struct gfs2_log_header *lh, struct gfs2_buffer_head *bh);
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 51dc004f..04f3ce2c 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -452,11 +452,11 @@ void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
#endif /* GFS2_HAS_DE_RAHEAD */
}
-void gfs2_leaf_in(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh)
+void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf)
{
- struct gfs2_leaf *str = (struct gfs2_leaf *)bh->b_data;
+ struct gfs2_leaf *str = (struct gfs2_leaf *)buf;
- gfs2_meta_header_in(&lf->lf_header, bh->b_data);
+ gfs2_meta_header_in(&lf->lf_header, buf);
CPIN_16(lf, str, lf_depth);
CPIN_16(lf, str, lf_entries);
CPIN_32(lf, str, lf_dirent_format);
@@ -472,11 +472,11 @@ void gfs2_leaf_in(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh)
#endif
}
-void gfs2_leaf_out(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh)
+void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf)
{
- struct gfs2_leaf *str = (struct gfs2_leaf *)bh->b_data;
+ struct gfs2_leaf *str = (struct gfs2_leaf *)buf;
- gfs2_meta_header_out(&lf->lf_header, bh->b_data);
+ gfs2_meta_header_out(&lf->lf_header, buf);
CPOUT_16(lf, str, lf_depth);
CPOUT_16(lf, str, lf_entries);
CPOUT_32(lf, str, lf_dirent_format);
@@ -490,7 +490,6 @@ void gfs2_leaf_out(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh)
#else
CPOUT_08(lf, str, lf_reserved, 64);
#endif
- bmodified(bh);
}
void gfs2_leaf_print(const struct gfs2_leaf *lf)
--
2.14.3
next prev parent reply other threads:[~2018-03-05 18:25 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 18:25 [Cluster-devel] [PATCH 00/20] gfs2-utils: Misc. tidy-ups Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 01/20] libgfs2: Remove unused lock* fields from gfs2_sbd Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 02/20] libgfs2: Remove sb_addr " Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 03/20] libgfs2: Plug an alignment hole in gfs2_sbd Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 04/20] libgfs2: Plug an alignment hole in gfs2_buffer_head Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 05/20] libgfs2: Plug an alignment hole in gfs2_inode Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 06/20] libgfs2: Remove gfs2_meta_header_out_bh() Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 07/20] libgfs2: Don't pass an extlen to block_map where not required Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 08/20] libgfs2: Don't use a buffer_head in gfs2_meta_header_in Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 09/20] libgfs2: Don't use buffer_heads in gfs2_sb_in Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 10/20] libgfs2: Don't use buffer_heads in gfs2_rgrp_in Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 11/20] libgfs2: Remove gfs2_rgrp_out_bh Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 12/20] libgfs2: Don't use buffer_heads in gfs2_dinode_in Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 13/20] libgfs2: Remove gfs2_dinode_out_bh Andrew Price
2018-03-05 18:25 ` Andrew Price [this message]
2018-03-05 18:25 ` [Cluster-devel] [PATCH 15/20] libgfs2: Don't use buffer_heads in gfs2_log_header_in Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 16/20] libgfs2: Remove gfs2_log_header_out_bh Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 17/20] libgfs2: Don't use buffer_heads in gfs2_log_descriptor_{in, out} Andrew Price
2018-03-05 19:00 ` Bob Peterson
2018-03-05 19:15 ` Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 18/20] libgfs2: Don't use buffer_heads in gfs2_quota_change_{in, out} Andrew Price
2018-03-05 19:02 ` Bob Peterson
2018-03-05 18:25 ` [Cluster-devel] [PATCH 19/20] libgfs2: Fix two unused variable warnings Andrew Price
2018-03-05 18:25 ` [Cluster-devel] [PATCH 20/20] mkfs.gfs2: Silence an integer overflow warning Andrew Price
2018-03-05 19:08 ` [Cluster-devel] [PATCH 00/20] gfs2-utils: Misc. tidy-ups Bob Peterson
2018-03-05 19:19 ` Andrew Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180305182549.17817-15-anprice@redhat.com \
--to=anprice@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).