[gfs2-utils] 02/38: fsck.gfs2: Initialize removed_lastmeta in
delete_block_if_notdup
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit dba0bc7c00dc522baa2762ebe2f2b8b29d735623
Author: Andrew Price <anprice(a)redhat.com>
Date: Tue Jun 7 17:37:33 2016 +0100
fsck.gfs2: Initialize removed_lastmeta in delete_block_if_notdup
Fixes clang warning:
afterpass1_common.c:99:8: note: Branch condition evaluates to a garbage value
if (removed_lastmeta)
^~~~~~~~~~~~~~~~
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/afterpass1_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gfs2/fsck/afterpass1_common.c b/gfs2/fsck/afterpass1_common.c
index e39bfea..b747640 100644
--- a/gfs2/fsck/afterpass1_common.c
+++ b/gfs2/fsck/afterpass1_common.c
@@ -79,7 +79,7 @@ static int delete_block_if_notdup(struct gfs2_inode *ip, uint64_t block,
void *private)
{
int q;
- int removed_lastmeta;
+ int removed_lastmeta = 0;
if (!valid_block_ip(ip, block))
return meta_error;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 01/38: gfs2_grow: Disable rgrp alignment when dev
topology is unsuitable
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit ae565c82568a8b8068c225d8534c68c9989ccbe3
Author: Andrew Price <anprice(a)redhat.com>
Date: Tue Mar 28 21:32:42 2017 +0100
gfs2_grow: Disable rgrp alignment when dev topology is unsuitable
If optimal_io_size is not a multiple of minimum_io_size then the values
are not reliable swidth and sunit values, so disable rgrp stripe
alignment in that case.
Resolves: rhbz#1436772
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_grow.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 173466c..66ba057 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -169,8 +169,12 @@ static lgfs2_rgrps_t rgrps_init(struct gfs2_sbd *sdp)
unsigned long min_io_sz = blkid_topology_get_minimum_io_size(tp);
unsigned long opt_io_sz = blkid_topology_get_optimal_io_size(tp);
unsigned long phy_sector_sz = blkid_topology_get_physical_sector_size(tp);
+ /* If optimal_io_size is not a multiple of minimum_io_size then
+ the values are not reliable swidth and sunit values, so don't
+ attempt rgrp alignment */
if ((min_io_sz > phy_sector_sz) &&
- (opt_io_sz > phy_sector_sz)) {
+ (opt_io_sz > phy_sector_sz) &&
+ (opt_io_sz % min_io_sz == 0)) {
al_base = opt_io_sz / sdp->bsize;
al_off = min_io_sz / sdp->bsize;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 02/02: libgfs2: Switch gfs2_log_header_out to use a
char buffer
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 464c6b73a94b1296f5218da3869b69e0f4832ae6
Author: Andrew Price <anprice(a)redhat.com>
Date: Mon Apr 10 17:11:01 2017 +0100
libgfs2: Switch gfs2_log_header_out to use a char buffer
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/fs_recovery.c | 2 +-
gfs2/libgfs2/libgfs2.h | 4 ++--
gfs2/libgfs2/ondisk.c | 12 ++++++++----
gfs2/libgfs2/structures.c | 4 ++--
gfs2/mkfs/main_jadd.c | 4 +---
5 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 17b2a3a..e50a248 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -445,7 +445,7 @@ static int check_journal_seq_no(struct gfs2_inode *ip, int fix)
log_warn( _("Renumbering it as 0x%llx\n"), lh.lh_sequence);
block_map(ip, blk, &new, &dblock, &extlen, FALSE);
bh = bread(ip->i_sbd, dblock);
- gfs2_log_header_out(&lh, bh);
+ gfs2_log_header_out_bh(&lh, bh);
brelse(bh);
}
if (seq_errors && fix) {
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 778238f..2e29d33 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -743,8 +743,8 @@ extern void gfs2_leaf_out(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh);
extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf);
extern void gfs2_log_header_in(struct gfs2_log_header *lh,
struct gfs2_buffer_head *bh);
-extern void gfs2_log_header_out(struct gfs2_log_header *lh,
- struct gfs2_buffer_head *bh);
+extern void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf);
+extern void gfs2_log_header_out_bh(struct gfs2_log_header *lh, struct gfs2_buffer_head *bh);
extern void gfs2_log_descriptor_in(struct gfs2_log_descriptor *ld,
struct gfs2_buffer_head *bh);
extern void gfs2_log_descriptor_out(struct gfs2_log_descriptor *ld,
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 3d82509..acedd3e 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -531,17 +531,21 @@ void gfs2_log_header_in(struct gfs2_log_header *lh,
CPIN_32(lh, str, lh_hash);
}
-void gfs2_log_header_out(struct gfs2_log_header *lh,
- struct gfs2_buffer_head *bh)
+void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf)
{
- struct gfs2_log_header *str = (struct gfs2_log_header *)bh->b_data;
+ struct gfs2_log_header *str = (struct gfs2_log_header *)buf;
- gfs2_meta_header_out_bh(&lh->lh_header, bh);
+ gfs2_meta_header_out(&lh->lh_header, buf);
CPOUT_64(lh, str, lh_sequence);
CPOUT_32(lh, str, lh_flags);
CPOUT_32(lh, str, lh_tail);
CPOUT_32(lh, str, lh_blkno);
CPOUT_32(lh, str, lh_hash);
+}
+
+void gfs2_log_header_out_bh(struct gfs2_log_header *lh, struct gfs2_buffer_head *bh)
+{
+ gfs2_log_header_out(lh, bh->iov.iov_base);
bmodified(bh);
}
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index e8247bf..2d97dab 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -132,7 +132,7 @@ int lgfs2_write_journal_data(struct gfs2_inode *ip)
do {
lh.lh_sequence = seq;
lh.lh_blkno = bh->b_blocknr - jext0;
- gfs2_log_header_out(&lh, bh);
+ gfs2_log_header_out_bh(&lh, bh);
hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
((struct gfs2_log_header *)bh->b_data)->lh_hash = cpu_to_be32(hash);
@@ -184,7 +184,7 @@ int write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blocks)
memset(bh->b_data, 0, bsize);
lh.lh_sequence = seq;
lh.lh_blkno = x;
- gfs2_log_header_out(&lh, bh);
+ gfs2_log_header_out_bh(&lh, bh);
hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
((struct gfs2_log_header *)bh->b_data)->lh_hash = cpu_to_be32(hash);
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index de5d9c5..3681b90 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -454,12 +454,10 @@ static void add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
for (x=0; x<blocks; x++) {
uint32_t hash;
- struct gfs2_buffer_head dummy_bh;
- dummy_bh.b_data = buf;
lh.lh_sequence = seq;
lh.lh_blkno = x;
- gfs2_log_header_out(&lh, &dummy_bh);
+ gfs2_log_header_out(&lh, buf);
hash = gfs2_disk_hash(buf, sizeof(struct gfs2_log_header));
((struct gfs2_log_header *)buf)->lh_hash = cpu_to_be32(hash);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 01/02: libgfs2: Switch gfs2_dinode_out to use a char
buffer
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 2f139f8c8851688a1119a134edaf6833aef93046
Author: Andrew Price <anprice(a)redhat.com>
Date: Mon Apr 10 16:40:42 2017 +0100
libgfs2: Switch gfs2_dinode_out to use a char buffer
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/fsck/lost_n_found.c | 2 +-
gfs2/fsck/rgrepair.c | 4 ++--
gfs2/libgfs2/fs_ops.c | 8 ++++----
gfs2/libgfs2/gfs1.c | 2 +-
gfs2/libgfs2/libgfs2.h | 4 ++--
gfs2/libgfs2/ondisk.c | 11 ++++++++---
gfs2/libgfs2/structures.c | 4 ++--
8 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 9845049..b3d6389 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -2321,7 +2321,7 @@ int main(int argc, char **argv)
{
struct gfs2_inode *ip = sb2.master_dir;
if (ip->i_bh->b_modified)
- gfs2_dinode_out(&ip->i_di, ip->i_bh);
+ gfs2_dinode_out_bh(&ip->i_di, ip->i_bh);
}
/* Copy old quotas */
copy_quotas(&sb2);
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index bd05223..2722b29 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -253,7 +253,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
log_notice( _("Added inode #%llu (0x%llx) to lost+found\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- gfs2_dinode_out(&lf_dip->i_di, lf_dip->i_bh);
+ gfs2_dinode_out_bh(&lf_dip->i_di, lf_dip->i_bh);
bwrite(lf_dip->i_bh);
return 0;
}
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index f397db1..6d5619a 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -1237,8 +1237,8 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count, int *sane)
permission. */
if (sdp->md.riinode->i_bh->b_modified) {
log_debug("Syncing rindex inode changes to disk.\n");
- gfs2_dinode_out(&sdp->md.riinode->i_di,
- sdp->md.riinode->i_bh);
+ gfs2_dinode_out_bh(&sdp->md.riinode->i_di,
+ sdp->md.riinode->i_bh);
bwrite(sdp->md.riinode->i_bh);
}
return 0;
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 3acfb67..a22e044 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -95,7 +95,7 @@ void inode_put(struct gfs2_inode **ip_in)
struct gfs2_sbd *sdp = ip->i_sbd;
if (ip->i_bh->b_modified) {
- gfs2_dinode_out(&ip->i_di, ip->i_bh);
+ gfs2_dinode_out_bh(&ip->i_di, ip->i_bh);
if (!ip->bh_owned && is_system_inode(sdp, block))
fprintf(stderr, "Warning: Change made to inode "
"were discarded.\n");
@@ -1317,7 +1317,7 @@ static void dir_make_exhash(struct gfs2_inode *dip)
for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ;
dip->i_di.di_depth = y;
- gfs2_dinode_out(&dip->i_di, dip->i_bh);
+ gfs2_dinode_out_bh(&dip->i_di, dip->i_bh);
bwrite(dip->i_bh);
}
@@ -1424,7 +1424,7 @@ static int __init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, st
di.di_entries = 2;
}
- gfs2_dinode_out(&di, bh);
+ gfs2_dinode_out_bh(&di, bh);
return 0;
}
@@ -1487,7 +1487,7 @@ int lgfs2_write_filemeta(struct gfs2_inode *ip)
char *start = bh->b_data;
if (height == 0) {
start += sizeof(struct gfs2_dinode);
- gfs2_dinode_out(&ip->i_di, bh);
+ gfs2_dinode_out_bh(&ip->i_di, bh);
} else {
start += sizeof(struct gfs2_meta_header);
gfs2_meta_header_out(&mh, bh->b_data);
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index c00d7be..2c84f78 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -243,7 +243,7 @@ int gfs1_writei(struct gfs2_inode *ip, char *buf, uint64_t offset,
}
ip->i_di.di_mtime = ip->i_di.di_ctime = time(NULL);
- gfs2_dinode_out(&ip->i_di, ip->i_bh);
+ gfs2_dinode_out_bh(&ip->i_di, ip->i_bh);
return copied;
}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index ebf6bca..778238f 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -734,8 +734,8 @@ extern void gfs2_quota_in(struct gfs2_quota *qu, char *buf);
extern void gfs2_quota_out(struct gfs2_quota *qu, char *buf);
extern void gfs2_dinode_in(struct gfs2_dinode *di,
struct gfs2_buffer_head *bh);
-extern void gfs2_dinode_out(struct gfs2_dinode *di,
- struct gfs2_buffer_head *bh);
+extern void gfs2_dinode_out(struct gfs2_dinode *di, char *buf);
+extern void gfs2_dinode_out_bh(struct gfs2_dinode *di, struct gfs2_buffer_head *bh);
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);
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 66de223..3d82509 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -319,11 +319,11 @@ void gfs2_dinode_in(struct gfs2_dinode *di, struct gfs2_buffer_head *bh)
CPIN_08(di, str, di_reserved, 32);
}
-void gfs2_dinode_out(struct gfs2_dinode *di, struct gfs2_buffer_head *bh)
+void gfs2_dinode_out(struct gfs2_dinode *di, char *buf)
{
- struct gfs2_dinode *str = (struct gfs2_dinode *)bh->b_data;
+ struct gfs2_dinode *str = (struct gfs2_dinode *)buf;
- gfs2_meta_header_out_bh(&di->di_header, bh);
+ gfs2_meta_header_out(&di->di_header, buf);
gfs2_inum_out(&di->di_num, (char *)&str->di_num);
CPOUT_32(di, str, di_mode);
@@ -352,6 +352,11 @@ void gfs2_dinode_out(struct gfs2_dinode *di, struct gfs2_buffer_head *bh)
CPOUT_64(di, str, di_eattr);
CPOUT_08(di, str, di_reserved, 32);
+}
+
+void gfs2_dinode_out_bh(struct gfs2_dinode *di, struct gfs2_buffer_head *bh)
+{
+ gfs2_dinode_out(di, bh->iov.iov_base);
bmodified(bh);
}
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 1cc88b5..e8247bf 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -295,7 +295,7 @@ int build_inum_range(struct gfs2_inode *per_node, unsigned int j)
return errno;
}
ip->i_di.di_size = sizeof(struct gfs2_inum_range);
- gfs2_dinode_out(&ip->i_di, ip->i_bh);
+ gfs2_dinode_out_bh(&ip->i_di, ip->i_bh);
if (cfg_debug) {
printf("\nInum Range %u:\n", j);
@@ -318,7 +318,7 @@ int build_statfs_change(struct gfs2_inode *per_node, unsigned int j)
return errno;
}
ip->i_di.di_size = sizeof(struct gfs2_statfs_change);
- gfs2_dinode_out(&ip->i_di, ip->i_bh);
+ gfs2_dinode_out_bh(&ip->i_di, ip->i_bh);
if (cfg_debug) {
printf("\nStatFS Change %u:\n", j);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 03/03: libgfs2: Issue one write per rgrp when creating
them
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 4bc3a0ce19e914c267d58f847f2b4b86ae997575
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Apr 13 12:19:01 2017 -0400
libgfs2: Issue one write per rgrp when creating them
Previously mkfs.gfs2 issued a write for each block of an rgrp. On
systems where the page size is much larger than the block size, this
incurs a read-modify-write overhead and can slow down mkfs.gfs2
considerably. Instead, allocate a single, aligned buffer for the bitmap
blocks and write them all in one go.
On a system with 64K pages and a 300TB block device, this speeds up
mkfs.gfs2 from over an hour to less than 3 minutes.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/rgrp.c | 51 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 32 insertions(+), 19 deletions(-)
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 7066a5c..bb0776a 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -11,6 +11,7 @@
#include "rgrp.h"
#define RG_SYNC_TOLERANCE 1000
+#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
static void compute_bitmaps(lgfs2_rgrp_t rg, const unsigned bsize)
{
@@ -109,23 +110,30 @@ struct rgrp_tree *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk)
int lgfs2_rgrp_bitbuf_alloc(lgfs2_rgrp_t rg)
{
struct gfs2_sbd *sdp = rg->rgrps->sdp;
+ struct gfs2_buffer_head *bhs;
+ size_t len = rg->ri.ri_length * sdp->bsize;
+ unsigned long io_align = sdp->bsize;
unsigned i;
char *bufs;
- bufs = calloc(rg->ri.ri_length, sizeof(struct gfs2_buffer_head) + sdp->bsize);
- if (bufs == NULL)
+ if (rg->rgrps->align > 0) {
+ len = ROUND_UP(len, rg->rgrps->align * sdp->bsize);
+ io_align = rg->rgrps->align_off * sdp->bsize;
+ }
+ bhs = calloc(rg->ri.ri_length, sizeof(struct gfs2_buffer_head));
+ if (bhs == NULL)
return 1;
- rg->bits[0].bi_bh = (struct gfs2_buffer_head *)bufs;
- rg->bits[0].bi_bh->iov.iov_base = (char *)(rg->bits[0].bi_bh + 1);
- rg->bits[0].bi_bh->iov.iov_len = sdp->bsize;
- rg->bits[0].bi_bh->b_blocknr = rg->ri.ri_addr;
- rg->bits[0].bi_bh->sdp = sdp;
+ if (posix_memalign((void **)&bufs, io_align, len) != 0) {
+ errno = ENOMEM;
+ free(bhs);
+ return 1;
+ }
+ memset(bufs, 0, len);
- for (i = 1; i < rg->ri.ri_length; i++) {
- char *nextbuf = rg->bits[i - 1].bi_bh->b_data + sdp->bsize;
- rg->bits[i].bi_bh = (struct gfs2_buffer_head *)(nextbuf);
- rg->bits[i].bi_bh->iov.iov_base = (char *)(rg->bits[i].bi_bh + 1);
+ for (i = 0; i < rg->ri.ri_length; i++) {
+ rg->bits[i].bi_bh = bhs + i;
+ rg->bits[i].bi_bh->iov.iov_base = bufs + (i * sdp->bsize);
rg->bits[i].bi_bh->iov.iov_len = sdp->bsize;
rg->bits[i].bi_bh->b_blocknr = rg->ri.ri_addr + i;
rg->bits[i].bi_bh->sdp = sdp;
@@ -143,6 +151,7 @@ int lgfs2_rgrp_bitbuf_alloc(lgfs2_rgrp_t rg)
void lgfs2_rgrp_bitbuf_free(lgfs2_rgrp_t rg)
{
unsigned i;
+ free(rg->bits[0].bi_bh->iov.iov_base);
free(rg->bits[0].bi_bh);
for (i = 0; i < rg->ri.ri_length; i++)
rg->bits[i].bi_bh = NULL;
@@ -618,7 +627,7 @@ lgfs2_rgrp_t lgfs2_rgrps_append(lgfs2_rgrps_t rgs, struct gfs2_rindex *entry)
*/
int lgfs2_rgrp_write(int fd, const lgfs2_rgrp_t rg)
{
- int ret = 0;
+ struct gfs2_sbd *sdp = rg->rgrps->sdp;
unsigned int i;
const struct gfs2_meta_header bmh = {
.mh_magic = GFS2_MAGIC,
@@ -626,25 +635,29 @@ int lgfs2_rgrp_write(int fd, const lgfs2_rgrp_t rg)
.mh_format = GFS2_FORMAT_RB,
};
int freebufs = 0;
+ ssize_t ret;
+ size_t len;
if (rg->bits[0].bi_bh == NULL) {
freebufs = 1;
if (lgfs2_rgrp_bitbuf_alloc(rg) != 0)
return -1;
}
-
gfs2_rgrp_out(&rg->rg, rg->bits[0].bi_bh->b_data);
- ret = bwrite(rg->bits[0].bi_bh);
-
- for (i = 1; ret == 0 && i < rg->ri.ri_length; i++) {
+ for (i = 1; i < rg->ri.ri_length; i++)
gfs2_meta_header_out(&bmh, rg->bits[i].bi_bh->b_data);
- ret = bwrite(rg->bits[i].bi_bh);
- }
+
+ len = sdp->bsize * rg->ri.ri_length;
+ if (rg->rgrps->align > 0)
+ len = ROUND_UP(len, rg->rgrps->align * sdp->bsize);
+
+ ret = pwrite(sdp->device_fd, rg->bits[0].bi_bh->b_data, len,
+ rg->bits[0].bi_bh->b_blocknr * sdp->bsize);
if (freebufs)
lgfs2_rgrp_bitbuf_free(rg);
- return ret;
+ return ret == len ? 0 : -1;
}
lgfs2_rgrp_t lgfs2_rgrp_first(lgfs2_rgrps_t rgs)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 02/03: mkfs.gfs2: Fix resource group alignment issue
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 f88e45d86355fbf12775fc4b8a8e6c77570031ce
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Apr 13 07:42:18 2017 -0400
mkfs.gfs2: Fix resource group alignment issue
Make sure the resource groups created when allocating the journals have
an aligned length to avoid subsequent resource groups start addresses
getting misaligned. This can cause read-modify-write issues during mkfs
and likely in other situations, harming performance.
Test case included.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 1 +
tests/mkfs.at | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 83065fb..2e08bc6 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -721,6 +721,7 @@ static int place_journals(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_o
if (mkfs_journals == NULL)
return 1;
*rgaddr = lgfs2_rgrp_align_addr(rgs, sdp->sb_addr + 1);
+ rgsize = lgfs2_rgrp_align_len(rgs, rgsize);
for (j = 0; j < opts->journals; j++) {
int result;
diff --git a/tests/mkfs.at b/tests/mkfs.at
index c026a76..274a81d 100644
--- a/tests/mkfs.at
+++ b/tests/mkfs.at
@@ -102,6 +102,13 @@ AT_CHECK([$GFS_MKFS -p lock_dlm -t "financial_cluster:this_time_we_test_fs_namin
GFS_FSCK_CHECK([$GFS_MKFS -p lock_dlm -t "a_really_long_named_cluster_here:concurrently_lets_check_fs_len" $GFS_TGT])
AT_CLEANUP
+# -o test_topology order:
+# alignment_offset,
+# logical_sector_size,
+# minimum_io_size,
+# optimal_io_size,
+# physical_sector_size
+
AT_SETUP([Device i/o limits handling])
AT_KEYWORDS(mkfs.gfs2 mkfs)
AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:0:0:0:0 $GFS_TGT], 0, [ignore], [ignore])
@@ -109,3 +116,10 @@ AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=7168:512:0:33553920:512 $GFS
AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=7168:512:8192:33553920:512 $GFS_TGT], 0, [ignore], [Warning: device is not properly aligned. This may harm performance.
])
AT_CLEANUP
+
+AT_SETUP([Resource group alignment])
+AT_KEYWORDS(mkfs.gfs2 mkfs)
+AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:512:65536:393216:512 $GFS_TGT], 0, [ignore], [ignore])
+# Check rgrp alignment to minimum_io_size: 65536 / 4096 == 16
+AT_CHECK([gfs2_edit -p rindex $GFS_TGT | grep ri_addr | awk '{print $2, $2 % 16; if ($2 % 16 != 0) { exit 1 }}'], 0, [ignore], [ignore])
+AT_CLEANUP
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years
[gfs2-utils] 01/03: mkfs.gfs2: Free unnecessary cached pages,
disable readahead
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 05ca8fcf35c35874b19b0597c1f6d2fff2814d7f
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Apr 13 06:51:15 2017 -0400
mkfs.gfs2: Free unnecessary cached pages, disable readahead
With a 300T file system, cached pages built up quite heavily and could
be left over from previous io on the device. Use POSIX_FADV_DONTNEED
where appropriate.
Also, readahead isn't required as mkfs.gfs2 mainly writing full block
ranges at unpredictable locations so use POSIX_FADV_RANDOM to minimise
the overhead from that.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 0801a4b..83065fb 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -817,6 +817,7 @@ static int place_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_opts
gfs2_progress_update(&progress, (sdp->rgrps));
}
gfs2_progress_close(&progress, _("Done\n"));
+ posix_fadvise(sdp->device_fd, 0, sdp->fssize * sdp->bsize, POSIX_FADV_DONTNEED);
return 0;
}
@@ -909,6 +910,11 @@ static void open_dev(struct mkfs_dev *dev, int withprobe)
exit(1);
}
+ /* Freshen up the cache */
+ posix_fadvise(dev->fd, 0, 0, POSIX_FADV_DONTNEED);
+ /* Turn off readahead, we're just writing new blocks */
+ posix_fadvise(dev->fd, 0, 0, POSIX_FADV_RANDOM);
+
error = fstat(dev->fd, &dev->stat);
if (error < 0) {
perror(dev->path);
@@ -1075,7 +1081,7 @@ int main(int argc, char *argv[])
perror(opts.dev.path);
exit(EXIT_FAILURE);
}
-
+ posix_fadvise(opts.dev.fd, 0, 0, POSIX_FADV_DONTNEED);
error = close(opts.dev.fd);
if (error){
perror(opts.dev.path);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
7 years