Skip to contentSkip to conversation

fsck.gfs2: Really be quiet in quiet mode

PATCH New Andrew Price 1 participant 2 messages Sep 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fsck.gfs2: Really be quiet in quiet mode

Using the -q option leaves some informational messages still printed as they're using log_warn. Switch them to log_notice so that they're not printed when -q is used.

---
 gfs2/fsck/initialize.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
gfs2/fsck/initialize.c +4 -4
index bb9755c..4a31927 100644
@@ -629,15 +629,15 @@ static int fetch_rgrps(struct gfs2_sbd *sdp)
 	/*******************************************************************
 	 ********  Validate and read in resource group information  ********
 	 *******************************************************************/
-	log_warn( _("Validating Resource Group index.\n"));
+	log_notice(_("Validating resource group index.\n"));
 	for (trust_lvl = blind_faith; trust_lvl <= indignation; trust_lvl++) {
 		int ret = 0;
 
-		log_warn( _("Level %d rgrp check: %s.\n"), trust_lvl + 1,
+		log_notice(_("Level %d resource group check: %s.\n"), trust_lvl + 1,
 			  level_desc[trust_lvl]);
 		if ((rg_repair(sdp, trust_lvl, &rgcount, &sane) == 0) &&
 		    ((ret = ri_update(sdp, 0, &rgcount, &sane)) == 0)) {
-			log_warn( _("(level %d passed)\n"), trust_lvl + 1);
+			log_notice(_("(level %d passed)\n"), trust_lvl + 1);
 			break;
 		} else {
 			if (ret < 0)
@@ -654,7 +654,7 @@ static int fetch_rgrps(struct gfs2_sbd *sdp)
 			break;
 	}
 	if (trust_lvl > indignation) {
-		log_err( _("Resource Group recovery impossible; I can't fix "
+		log_err( _("Resource group recovery impossible; I can't fix "
 			   "this file system.\n"));
 		return -1;
 	}
Signature · 1 line
2.4.3
#1 lore raw

PATCH 2/2 fsck.gfs2: Improve read ahead in pass1_process_bitmap

The read ahead strategy in this function was pretty naive, it just read in all of the inode blocks, in block-sized reads, before doing any processing. In my tests with a full filesystem, removing this read ahead actually sped up the tests, presumably due to issuing a large number of small I/Os and not keeping them cached. Moving the read ahead into the processing loop and reading ahead by larger chunks after certain periods gave improved performance. After some experimentation, I found the best performance was given by reading ahead 100 blocks after every 50 inodes processed. Timings were:

    Master        Without R.A.  With this patch
    51:03.41      48:07.40      47:13.66
    50:56.45      48:07.42      47:01.04
    51:02.25      48:00.06      47:05.72

I would expect the performance gain to be larger on filesystems with a higher density of inode blocks.

---
 gfs2/fsck/pass1.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
gfs2/fsck/pass1.c +9 -4
index c0f2f1e..653be59 100644
@@ -1532,17 +1532,22 @@ static int pass1_process_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, uin
 	uint64_t block;
 	struct gfs2_inode *ip;
 	uint8_t q;
+	/* Readahead numbers arrived at by experiment */
+	unsigned rawin = 50;
+	unsigned ralen = 100 * sdp->bsize;
+	unsigned r = 0;
 
-	/* Issue read-ahead for all dinodes in this bitmap */
-	for (i = 0; i < n; i++)
-		posix_fadvise(sdp->device_fd, ibuf[i] * sdp->bsize, sdp->bsize,
-			      POSIX_FADV_WILLNEED);
 	for (i = 0; i < n; i++) {
 		int is_inode;
 		uint32_t check_magic;
 
 		block = ibuf[i];
 
+		if (r++ == rawin) {
+			posix_fadvise(sdp->device_fd, block * sdp->bsize, ralen, POSIX_FADV_WILLNEED);
+			r = 0;
+		}
+
 		/* skip gfs1 rindex indirect blocks */
 		if (sdp->gfs1 && blockfind(&gfs1_rindex_blks, block)) {
 			log_debug(_("Skipping rindex indir block "
Signature · 1 line
2.4.3