This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master in repository gfs2-utils.
commit 7622490f8230856969ee0a3ca5ca3d4da94fa5fc Author: Andrew Price anprice@redhat.com AuthorDate: Fri Jun 11 12:50:50 2021 +0100
libgfs2: Remove gfs_jindex_in
Also fix some endianness tagging in gfs1.c so that it's now sparse-clean.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/edit/extended.c | 14 +++++++------- gfs2/edit/hexedit.h | 1 - gfs2/edit/journal.c | 7 +++---- gfs2/edit/savemeta.c | 8 ++++---- gfs2/fsck/fs_recovery.c | 7 ++++--- gfs2/fsck/initialize.c | 16 ++++++++-------- gfs2/libgfs2/gfs1.c | 19 +++---------------- gfs2/libgfs2/libgfs2.h | 1 - 8 files changed, 29 insertions(+), 44 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c index 975a514c..92dbb415 100644 --- a/gfs2/edit/extended.c +++ b/gfs2/edit/extended.c @@ -424,15 +424,15 @@ static void print_block_details(struct iinfo *ind, int level, int cur_height,
static void gfs_jindex_print(struct gfs_jindex *ji) { - pv(ji, ji_addr, "%"PRIu64, "0x%"PRIx64); - pv(ji, ji_nsegment, "%"PRIu32, "0x%"PRIx32); - pv(ji, ji_pad, "%"PRIu32, "0x%"PRIx32); + print_it(" ji_addr", "%"PRIu64, "0x%"PRIx64, be64_to_cpu(ji->ji_addr)); + print_it(" ji_nsegment", "%"PRIu32, "0x%"PRIx32, be32_to_cpu(ji->ji_nsegment)); + print_it(" ji_pad", "%"PRIu32, "0x%"PRIx32, be32_to_cpu(ji->ji_pad)); }
static int print_gfs_jindex(struct gfs2_inode *dij) { int error, start_line; - struct gfs_jindex ji; + struct gfs_jindex *ji; char jbuf[sizeof(struct gfs_jindex)];
start_line = line; @@ -444,7 +444,7 @@ static int print_gfs_jindex(struct gfs2_inode *dij) error = gfs2_readi(dij, (void *)&jbuf, print_entry_ndx*sizeof(struct gfs_jindex), sizeof(struct gfs_jindex)); - gfs_jindex_in(&ji, jbuf); + ji = (struct gfs_jindex *)jbuf; if (!error) /* end of file */ break; if (!termlines || @@ -454,13 +454,13 @@ static int print_gfs_jindex(struct gfs2_inode *dij) if (edit_row[dmode] == print_entry_ndx) { COLORS_HIGHLIGHT; strcpy(efield, "ji_addr"); - sprintf(estring, "%"PRIx64, ji.ji_addr); + sprintf(estring, "%"PRIx64, be64_to_cpu(ji->ji_addr)); } print_gfs2("Journal #%d", print_entry_ndx); eol(0); if (edit_row[dmode] == print_entry_ndx) COLORS_NORMAL; - gfs_jindex_print(&ji); + gfs_jindex_print(ji); last_entry_onscreen[dmode] = print_entry_ndx; } } diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h index dd509085..adbeb742 100644 --- a/gfs2/edit/hexedit.h +++ b/gfs2/edit/hexedit.h @@ -225,7 +225,6 @@ extern int block_is_statfs_file(uint64_t blk); extern int block_is_quota_file(uint64_t blk); extern int block_is_per_node(uint64_t blk); extern int display_block_type(char *buf, uint64_t addr, int from_restore); -extern void gfs_jindex_in(struct gfs_jindex *jindex, char *buf); extern void gfs_log_header_print(void *lhp); extern void savemeta(char *out_fn, int saveoption, int gziplevel); extern void restoremeta(const char *in_fn, const char *out_device, diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c index 95fa7c23..1baba02f 100644 --- a/gfs2/edit/journal.c +++ b/gfs2/edit/journal.c @@ -58,7 +58,6 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
if (sbd.gfs1) { struct gfs2_inode *jiinode; - struct gfs_jindex ji;
jiinode = lgfs2_inode_get(&sbd, jindex_bh); if (jiinode == NULL) @@ -67,9 +66,9 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size) journal_num * sizeof(struct gfs_jindex), sizeof(struct gfs_jindex)); if (amtread) { - gfs_jindex_in(&ji, jbuf); - jblock = ji.ji_addr; - *j_size = (uint64_t)ji.ji_nsegment * 0x10; + struct gfs_jindex *ji = (struct gfs_jindex *)jbuf; + jblock = be64_to_cpu(ji->ji_addr); + *j_size = (uint64_t)be32_to_cpu(ji->ji_nsegment) * 0x10; } inode_put(&jiinode); } else { diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c index 4beff2ca..a99930c2 100644 --- a/gfs2/edit/savemeta.c +++ b/gfs2/edit/savemeta.c @@ -943,7 +943,7 @@ static void get_journal_inode_blocks(void) struct gfs2_inode *j_inode = NULL;
if (sbd.gfs1) { - struct gfs_jindex ji; + struct gfs_jindex *ji; char jbuf[sizeof(struct gfs_jindex)];
j_inode = lgfs2_gfs_inode_read(&sbd, sbd.sd_jindex_di.in_addr); @@ -957,9 +957,9 @@ static void get_journal_inode_blocks(void) inode_put(&j_inode); if (!amt) break; - gfs_jindex_in(&ji, jbuf); - jblock = ji.ji_addr; - gfs1_journal_size = (uint64_t)ji.ji_nsegment * 16; + ji = (struct gfs_jindex *)jbuf; + jblock = be64_to_cpu(ji->ji_addr); + gfs1_journal_size = (uint64_t)be32_to_cpu(ji->ji_nsegment) * 16; } else { if (journal + 3 > indirect->ii[0].dirents) break; diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c index bbfd7783..e6744dc2 100644 --- a/gfs2/fsck/fs_recovery.c +++ b/gfs2/fsck/fs_recovery.c @@ -752,7 +752,6 @@ int ji_update(struct gfs2_sbd *sdp) char journal_name[JOURNAL_NAME_SIZE]; int i, error; char buf[sizeof(struct gfs_jindex)]; - struct gfs_jindex ji;
if (!ip) { log_crit(_("Journal index inode not found.\n")); @@ -778,6 +777,8 @@ int ji_update(struct gfs2_sbd *sdp) memset(journal_name, 0, sizeof(*journal_name)); for (i = 0; i < sdp->md.journals; i++) { if (sdp->gfs1) { + struct gfs_jindex *ji; + error = gfs2_readi(ip, buf, i * sizeof(struct gfs_jindex), sizeof(struct gfs_jindex)); @@ -788,8 +789,8 @@ int ji_update(struct gfs2_sbd *sdp) " journal index file.\n")); return -1; } - gfs_jindex_in(&ji, buf); - sdp->md.journal[i] = lgfs2_inode_read(sdp, ji.ji_addr); + ji = (struct gfs_jindex *)buf; + sdp->md.journal[i] = lgfs2_inode_read(sdp, be64_to_cpu(ji->ji_addr)); if (sdp->md.journal[i] == NULL) return -1; } else { diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c index 0869a43e..039a0fd7 100644 --- a/gfs2/fsck/initialize.c +++ b/gfs2/fsck/initialize.c @@ -1468,7 +1468,7 @@ static int reset_journal_seg_size(struct gfs2_sbd *sdp, unsigned int jsize, unsi static int correct_journal_seg_size(struct gfs2_sbd *sdp) { int count; - struct gfs_jindex ji_0, ji_1; + struct gfs_jindex *ji_0, *ji_1; char buf[sizeof(struct gfs_jindex)]; unsigned int jsize = GFS2_DEFAULT_JSIZE * 1024 * 1024;
@@ -1478,7 +1478,7 @@ static int correct_journal_seg_size(struct gfs2_sbd *sdp) "Aborting\n"), count); return -1; } - gfs_jindex_in(&ji_0, buf); + ji_0 = (struct gfs_jindex *)buf;
if (sdp->md.journals == 1) { if (sdp->sd_seg_size == 0) { @@ -1505,11 +1505,11 @@ static int correct_journal_seg_size(struct gfs2_sbd *sdp) "Aborting\n"), count); return -1; } - gfs_jindex_in(&ji_1, buf); + ji_1 = (struct gfs_jindex *)buf;
- jsize = (ji_1.ji_addr - ji_0.ji_addr) * sdp->sd_bsize; + jsize = (be64_to_cpu(ji_1->ji_addr) - be64_to_cpu(ji_0->ji_addr)) * sdp->sd_bsize; out: - return reset_journal_seg_size(sdp, jsize, ji_0.ji_nsegment); + return reset_journal_seg_size(sdp, jsize, be32_to_cpu(ji_0->ji_nsegment)); }
/* @@ -1521,7 +1521,7 @@ out: static int reconstruct_journals(struct gfs2_sbd *sdp) { int i, count; - struct gfs_jindex ji; + struct gfs_jindex *ji; char buf[sizeof(struct gfs_jindex)];
/* Ensure that sb_seg_size is valid */ @@ -1537,10 +1537,10 @@ static int reconstruct_journals(struct gfs2_sbd *sdp) sizeof(struct gfs_jindex)); if (count != sizeof(struct gfs_jindex)) return 0; - gfs_jindex_in(&ji, buf); + ji = (struct gfs_jindex *)buf; if ((i % 2) == 0) log_err("."); - if (reconstruct_single_journal(sdp, i, ji.ji_nsegment)) + if (reconstruct_single_journal(sdp, i, be32_to_cpu(ji->ji_nsegment))) return -1; } log_err(_("\nJournals cleared.\n")); diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c index feb8d22a..272f5572 100644 --- a/gfs2/libgfs2/gfs1.c +++ b/gfs2/libgfs2/gfs1.c @@ -22,13 +22,13 @@ static __inline__ int fs_is_jdata(struct gfs2_inode *ip) return ip->i_flags & GFS2_DIF_JDATA; }
-static __inline__ uint64_t * +static __inline__ __be64 * 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 *)(buf + head_size)) + mp->mp_list[height]; + return ((__be64 *)(buf + head_size)) + mp->mp_list[height]; }
int is_gfs_dir(struct gfs2_inode *ip) @@ -42,7 +42,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->b_data, height, mp); + __be64 *ptr = gfs1_metapointer(bh->b_data, height, mp);
if (*ptr) { *block = be64_to_cpu(*ptr); @@ -307,19 +307,6 @@ struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr) return ip; }
-/* ------------------------------------------------------------------------ */ -/* gfs_jindex_in - read in a gfs1 jindex structure. */ -/* ------------------------------------------------------------------------ */ -void gfs_jindex_in(struct gfs_jindex *jindex, char *jbuf) -{ - struct gfs_jindex *str = (struct gfs_jindex *) jbuf; - - jindex->ji_addr = be64_to_cpu(str->ji_addr); - jindex->ji_nsegment = be32_to_cpu(str->ji_nsegment); - jindex->ji_pad = be32_to_cpu(str->ji_pad); - memcpy(jindex->ji_reserved, str->ji_reserved, 64); -} - void lgfs2_gfs_rgrp_in(const lgfs2_rgrp_t rg, void *buf) { struct gfs_rgrp *r = buf; diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index e3afa464..c8ec05aa 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -736,7 +736,6 @@ extern int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset, unsigned int size); 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 lgfs2_gfs_rgrp_in(const lgfs2_rgrp_t rg, void *buf); extern void lgfs2_gfs_rgrp_out(const lgfs2_rgrp_t rg, void *buf);
cluster-commits@lists.fedorahosted.org