This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit 10deb2492c8b0dd4dceb963850c91e053bb8d6df
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.
Resolves: rhbz#1440269
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.
Show replies by date