[gfs2-utils] 04/20: libgfs2: Plug an alignment hole in
gfs2_buffer_head
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 121b8034118e48790e9940b4a3759c85df30c227
Author: Andrew Price <anprice(a)redhat.com>
Date: Sun Mar 4 18:54:48 2018 +0000
libgfs2: Plug an alignment hole in gfs2_buffer_head
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index dfe593e..6970c11 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -217,12 +217,12 @@ extern struct osi_node *lgfs2_rgrps_root(lgfs2_rgrps_t rgs) __attribute__((depre
struct gfs2_buffer_head {
osi_list_t b_altlist; /* alternate list */
uint64_t b_blocknr;
- int b_modified;
union {
char *b_data;
struct iovec iov;
};
struct gfs2_sbd *sdp;
+ int b_modified;
};
struct special_blocks {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
6 years, 2 months
[gfs2-utils] 03/20: libgfs2: Plug an alignment hole in gfs2_sbd
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 93d4d3a8586e3481060faa2dfc003f302523ca9e
Author: Andrew Price <anprice(a)redhat.com>
Date: Sun Mar 4 17:15:28 2018 +0000
libgfs2: Plug an alignment hole in gfs2_sbd
Allows struct gfs2_sbd to fit in 14 cachelines instead of 15
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index a85b9ce..dfe593e 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -276,8 +276,8 @@ struct gfs2_sbd {
uint32_t sd_blocks_per_bitmap;
uint32_t sd_max_dirres;
uint32_t sd_max_height;
- uint64_t sd_heightsize[GFS2_MAX_META_HEIGHT];
uint32_t sd_max_jheight;
+ uint64_t sd_heightsize[GFS2_MAX_META_HEIGHT];
uint64_t sd_jheightsize[GFS2_MAX_META_HEIGHT];
/* Not specified on the command line, but... */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
6 years, 2 months
[gfs2-utils] 02/20: libgfs2: Remove sb_addr from gfs2_sbd
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 89586ed46f7d66f71c85d4034b0e02d166a8852d
Author: Andrew Price <anprice(a)redhat.com>
Date: Sun Mar 4 17:01:30 2018 +0000
libgfs2: Remove sb_addr from gfs2_sbd
The sb address is constant so we can just shift it to the fs block size.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/edit/hexedit.c | 4 ++--
gfs2/edit/savemeta.c | 2 +-
gfs2/fsck/fs_recovery.c | 2 +-
gfs2/fsck/fsck.h | 4 ++--
gfs2/fsck/pass1.c | 2 +-
gfs2/fsck/rgrepair.c | 20 ++++++++++----------
gfs2/libgfs2/fs_bits.c | 2 +-
gfs2/libgfs2/lang.c | 2 +-
gfs2/libgfs2/libgfs2.h | 3 +--
gfs2/libgfs2/misc.c | 2 --
gfs2/libgfs2/super.c | 1 -
gfs2/mkfs/main_mkfs.c | 4 ++--
13 files changed, 23 insertions(+), 27 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index d5e98e6..4b18c77 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -2343,7 +2343,7 @@ int main(int argc, char **argv)
/* end because if the tool is interrupted in the middle, we want */
/* it to not reject the partially converted fs as already done */
/* when it's run a second time. */
- bh = bread(&sb2, sb2.sb_addr);
+ bh = bread(&sb2, LGFS2_SB_ADDR(&sb2));
sb2.sd_sb.sb_fs_format = GFS2_FORMAT_FS;
sb2.sd_sb.sb_multihost_format = GFS2_FORMAT_MULTI;
gfs2_sb_out(&sb2.sd_sb, bh->b_data);
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index b67fde2..9600118 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -1708,7 +1708,7 @@ static void find_print_block_rg(int bitmap)
struct rgrp_tree *rgd;
rblock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
- if (rblock == sbd.sb_addr)
+ if (rblock == LGFS2_SB_ADDR(&sbd))
printf("0 (the superblock is not in the bitmap)\n");
else {
rgd = gfs2_blk2rgrpd(&sbd, rblock);
@@ -1762,7 +1762,7 @@ static void find_change_block_alloc(int *newval)
exit(-1);
}
ablock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
- if (ablock == sbd.sb_addr)
+ if (ablock == LGFS2_SB_ADDR(&sbd))
printf("3 (the superblock is not in the bitmap)\n");
else {
rgd = gfs2_blk2rgrpd(&sbd, ablock);
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 664484f..a15fcf2 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -470,7 +470,7 @@ static int save_block(int fd, struct metafd *mfd, uint64_t blk, uint64_t owner,
struct gfs2_buffer_head *savebh;
int err;
- if (gfs2_check_range(&sbd, blk) && blk != sbd.sb_addr) {
+ if (gfs2_check_range(&sbd, blk) && blk != LGFS2_SB_ADDR(&sbd)) {
fprintf(stderr, "\nWarning: bad block pointer '0x%llx' "
"ignored in block (block %llu (0x%llx))",
(unsigned long long)blk,
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 775c27b..7284868 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -626,7 +626,7 @@ reinit:
* through initialization properly yet. */
static int rangecheck_jblock(struct gfs2_inode *ip, uint64_t block)
{
- if((block > ip->i_sbd->fssize) || (block <= ip->i_sbd->sb_addr)) {
+ if((block > ip->i_sbd->fssize) || (block <= LGFS2_SB_ADDR(ip->i_sbd))) {
log_info( _("Bad block pointer (out of range) found in "
"journal inode %lld (0x%llx).\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index 8af4eb4..d3f7635 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -166,7 +166,7 @@ extern struct gfs_sb *sbd1;
static inline int valid_block(struct gfs2_sbd *sdp, uint64_t blkno)
{
- return !((blkno > sdp->fssize) || (blkno <= sdp->sb_addr) ||
+ return !((blkno > sdp->fssize) || (blkno <= LGFS2_SB_ADDR(sdp)) ||
(lgfs2_get_bitmap(sdp, blkno, NULL) < 0));
}
@@ -186,7 +186,7 @@ static inline int valid_block_ip(struct gfs2_inode *ip, uint64_t blk)
if (blk > sdp->fssize)
return 0;
- if (blk <= sdp->sb_addr)
+ if (blk <= LGFS2_SB_ADDR(sdp))
return 0;
if (rgd == NULL || !rgrp_contains_block(rgd, blk)) {
rgd = gfs2_blk2rgrpd(sdp, blk);
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 6dd115f..87fab9a 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1569,7 +1569,7 @@ static void check_i_goal(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
if (sdp->gfs1 || ip->i_di.di_flags & GFS2_DIF_SYSTEM)
return;
- if (ip->i_di.di_goal_meta <= sdp->sb_addr ||
+ if (ip->i_di.di_goal_meta <= LGFS2_SB_ADDR(sdp) ||
ip->i_di.di_goal_meta > sdp->fssize) {
log_err(_("Inode #%llu (0x%llx): Bad allocation goal block "
"found: %llu (0x%llx)\n"),
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 6d5619a..f15266e 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -116,13 +116,13 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
find_journaled_rgs(sdp);
initial_first_rg_dist = dist_array[0] = block_last_rg =
- sdp->sb_addr + 1;
+ LGFS2_SB_ADDR(sdp) + 1;
shortest_dist_btwn_rgs = sdp->device.length;
- for (blk = sdp->sb_addr + 1; blk < sdp->device.length; blk++) {
+ for (blk = LGFS2_SB_ADDR(sdp) + 1; blk < sdp->device.length; blk++) {
uint64_t dist;
- if (blk == sdp->sb_addr + 1)
+ if (blk == LGFS2_SB_ADDR(sdp) + 1)
is_rgrp = 1;
else if (is_false_rg(blk))
is_rgrp = 0;
@@ -187,7 +187,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
log_info(_("segment %d: rgrp found at block 0x%llx\n"),
gsegment + 1, (unsigned long long)blk);
dist = blk - block_last_rg;
- if (blk > sdp->sb_addr + 1) { /* not the very first rgrp */
+ if (blk > LGFS2_SB_ADDR(sdp) + 1) { /* not the very first rgrp */
log_info("dist 0x%llx = 0x%llx - 0x%llx ",
(unsigned long long)dist,
@@ -245,9 +245,9 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
sizeof(struct gfs2_rindex),
sizeof(struct gfs2_rindex));
gfs2_rindex_in(&tmpndx, (char *)&buf);
- if (tmpndx.ri_addr > sdp->sb_addr + 1) { /* sanity check */
+ if (tmpndx.ri_addr > LGFS2_SB_ADDR(sdp) + 1) { /* sanity check */
log_warn( _("rgrp 2 is damaged: getting dist from index: "));
- *dist_array = tmpndx.ri_addr - (sdp->sb_addr + 1);
+ *dist_array = tmpndx.ri_addr - (LGFS2_SB_ADDR(sdp) + 1);
log_warn("0x%llx\n", (unsigned long long)*dist_array);
} else {
log_warn( _("rgrp index 2 is damaged: extrapolating dist: "));
@@ -558,7 +558,7 @@ static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs,
/* -------------------------------------------------------------- */
prev_rgd = NULL;
block_bump = rg_dist[0];
- blk = sdp->sb_addr + 1;
+ blk = LGFS2_SB_ADDR(sdp) + 1;
while (blk <= sdp->device.length) {
log_debug( _("Block 0x%llx\n"), (unsigned long long)blk);
bh = bread(sdp, blk);
@@ -631,7 +631,7 @@ static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs,
/*
* Figure out where our next rgrp should be.
*/
- if ((blk == sdp->sb_addr + 1) || (!gfs_grow)) {
+ if ((blk == LGFS2_SB_ADDR(sdp) + 1) || (!gfs_grow)) {
block_bump = rg_dist[segment];
if (segment_rgs >= rg_dcnt[segment]) {
log_debug(_("End of segment %d\n"), ++segment);
@@ -772,7 +772,7 @@ static void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree, i
/* of rgs based on the size of the device. */
/* If we have existing RGs (i.e. gfs2_grow) find the last one. */
if (!rgtree->osi_node) {
- dev->length -= sdp->sb_addr + 1;
+ dev->length -= LGFS2_SB_ADDR(sdp) + 1;
nrgrp = how_many_rgrps(sdp, dev, rgsize_specified);
rglength = dev->length / nrgrp;
sdp->new_rgrps = nrgrp;
@@ -807,7 +807,7 @@ static void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree, i
rl = rgrp_insert(rgtree, rgaddr);
rl->length = rglength;
} else {
- rgaddr = sdp->sb_addr + 1;
+ rgaddr = LGFS2_SB_ADDR(sdp) + 1;
rl = rgrp_insert(rgtree, rgaddr);
rl->length = dev->length -
(nrgrp - 1) * (dev->length / nrgrp);
diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index 93ddc13..e6aef55 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -108,7 +108,7 @@ unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
*/
int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
{
- if((blkno > sdp->fssize) || (blkno <= sdp->sb_addr))
+ if((blkno > sdp->fssize) || (blkno <= LGFS2_SB_ADDR(sdp)))
return -1;
return 0;
}
diff --git a/gfs2/libgfs2/lang.c b/gfs2/libgfs2/lang.c
index 2f93c56..62ad2ab 100644
--- a/gfs2/libgfs2/lang.c
+++ b/gfs2/libgfs2/lang.c
@@ -213,7 +213,7 @@ static uint64_t ast_lookup_id(const char *id, struct gfs2_sbd *sbd)
}
switch (i) {
case ID_SB:
- bn = sbd->sb_addr;
+ bn = LGFS2_SB_ADDR(sbd);
break;
case ID_MASTER:
bn = sbd->sd_sb.sb_master_dir.no_addr;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 641cac2..a85b9ce 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -254,6 +254,7 @@ struct master_dir
uint32_t journals; /* Journal count */
};
+#define LGFS2_SB_ADDR(sdp) (GFS2_SB_ADDR >> (sdp)->sd_fsb2bb_shift)
struct gfs2_sbd {
struct gfs2_sb sd_sb; /* a copy of the ondisk structure */
@@ -289,8 +290,6 @@ struct gfs2_sbd {
int device_fd;
int path_fd;
- uint64_t sb_addr;
-
uint64_t fssize;
uint64_t blks_total;
uint64_t blks_alloced;
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index cb2a231..f6ae74c 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -44,8 +44,6 @@ int compute_constants(struct gfs2_sbd *sdp)
sdp->md.next_inum = 1;
sdp->sd_sb.sb_bsize_shift = ffs(sdp->bsize) - 1;
- sdp->sb_addr = GFS2_SB_ADDR * GFS2_BASIC_BLOCK / sdp->bsize;
-
sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift -
GFS2_BASIC_BLOCK_SHIFT;
sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
index 6175203..4b80da2 100644
--- a/gfs2/libgfs2/super.c
+++ b/gfs2/libgfs2/super.c
@@ -119,7 +119,6 @@ int read_sb(struct gfs2_sbd *sdp)
return -1;
}
sdp->fssize = lseek(sdp->device_fd, 0, SEEK_END) / sdp->sd_sb.sb_bsize;
- sdp->sb_addr = GFS2_SB_ADDR * GFS2_BASIC_BLOCK / sdp->bsize;
sdp->sd_blocks_per_bitmap = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header))
* GFS2_NBBY;
sdp->qcsize = GFS2_DEFAULT_QCSIZE;
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 05e9749..42ce6dd 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -721,7 +721,7 @@ static int place_journals(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_o
mkfs_journals = calloc(opts->journals, sizeof(*mkfs_journals));
if (mkfs_journals == NULL)
return 1;
- *rgaddr = lgfs2_rgrp_align_addr(rgs, sdp->sb_addr + 1);
+ *rgaddr = lgfs2_rgrp_align_addr(rgs, LGFS2_SB_ADDR(sdp) + 1);
rgsize = lgfs2_rgrp_align_len(rgs, rgsize);
for (j = 0; j < opts->journals; j++) {
@@ -1035,7 +1035,7 @@ int main(int argc, char *argv[])
if (!opts.quiet)
printf("%s", _("Done\n"));
}
- rgaddr = lgfs2_rgrp_align_addr(rgs, sbd.sb_addr + 1);
+ rgaddr = lgfs2_rgrp_align_addr(rgs, LGFS2_SB_ADDR(&sbd) + 1);
error = place_journals(&sbd, rgs, &opts, &rgaddr);
if (error != 0) {
fprintf(stderr, _("Failed to create journals\n"));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
6 years, 2 months
[gfs2-utils] 01/20: libgfs2: Remove unused lock* fields from
gfs2_sbd
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 3b05667857726941184ecc4eefcc0c585aebe173
Author: Andrew Price <anprice(a)redhat.com>
Date: Sun Mar 4 16:55:10 2018 +0000
libgfs2: Remove unused lock* fields from gfs2_sbd
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 15d2a9d..641cac2 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -256,8 +256,6 @@ struct master_dir
struct gfs2_sbd {
struct gfs2_sb sd_sb; /* a copy of the ondisk structure */
- char lockproto[GFS2_LOCKNAME_LEN];
- char locktable[GFS2_LOCKNAME_LEN];
unsigned int bsize; /* The block size of the FS (in bytes) */
unsigned int jsize; /* Size of journals (in MB) */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
6 years, 2 months
[gfs2-utils] 01/01: fsck.gfs2: Don't check lh_crc for older
filesystems
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit f84d84e7693b3d95095fc42d1b21d6a511a1d2c0
Author: Andrew Price <anprice(a)redhat.com>
Date: Mon Mar 5 16:41:32 2018 +0000
fsck.gfs2: Don't check lh_crc for older filesystems
This fixes the case where fsck.gfs2 is built against v2 log headers but
the filesystem pre-dates them and so lh_crc is 0.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/recovery.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
index 51d210e..b813d69 100644
--- a/gfs2/libgfs2/recovery.c
+++ b/gfs2/libgfs2/recovery.c
@@ -76,7 +76,10 @@ int get_log_header(struct gfs2_inode *ip, unsigned int blk,
#ifdef GFS2_HAS_LH_V2
lh_crc = lh.lh_crc;
#endif
- if (error || lh.lh_blkno != blk || lh.lh_hash != hash || lh_crc != crc)
+ if (error || lh.lh_blkno != blk || lh.lh_hash != hash)
+ return 1;
+ /* Don't check the crc if it's zero, as it is in pre-v2 log headers */
+ if (lh_crc != 0 && lh_crc != crc)
return 1;
*head = lh;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
6 years, 2 months