!11 backport gfs2_jadd: Don't fsync after each block written
From: @ikernel-mryao Reviewed-by: @Charlie_li Signed-off-by: @Charlie_li
This commit is contained in:
commit
b69e835d02
57
0004-gfs2_jadd-Don-t-fsync-after-each-block-written.patch
Normal file
57
0004-gfs2_jadd-Don-t-fsync-after-each-block-written.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
From 657bbcfb7114b0246c6ce72cde75fcacb9a0d61b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Price <anprice@redhat.com>
|
||||||
|
Date: Thu, 18 Mar 2021 17:50:16 +0000
|
||||||
|
Subject: [PATCH] gfs2_jadd: Don't fsync after each block written
|
||||||
|
|
||||||
|
gfs2_jadd has always called fsync() after writing each block of the
|
||||||
|
journal. There doesn't seem to be any need for that so take the fsync()
|
||||||
|
call out of the loop.
|
||||||
|
|
||||||
|
Add an additional fsync() after preallocation to make sure we're in good
|
||||||
|
shape before writing the log headers.
|
||||||
|
|
||||||
|
In my tests this reduces the time to add one journal from 5 minutes to
|
||||||
|
9 seconds.
|
||||||
|
|
||||||
|
Signed-off-by: Andrew Price <anprice@redhat.com>
|
||||||
|
---
|
||||||
|
gfs2/mkfs/main_jadd.c | 15 ++++++++++-----
|
||||||
|
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
|
||||||
|
index 0a18bfb2..2bd0f7b0 100644
|
||||||
|
--- a/gfs2/mkfs/main_jadd.c
|
||||||
|
+++ b/gfs2/mkfs/main_jadd.c
|
||||||
|
@@ -537,6 +537,11 @@ static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
|
||||||
|
if (error != 0)
|
||||||
|
goto close_fd;
|
||||||
|
|
||||||
|
+ error = fsync(fd);
|
||||||
|
+ if (error != 0) {
|
||||||
|
+ perror("Failed to sync journal metadata");
|
||||||
|
+ goto close_fd;
|
||||||
|
+ }
|
||||||
|
if ((error = lseek(fd, 0, SEEK_SET)) < 0) {
|
||||||
|
perror("add_j lseek");
|
||||||
|
goto close_fd;
|
||||||
|
@@ -580,12 +585,12 @@ static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
|
||||||
|
seq = 0;
|
||||||
|
off += sdp->bsize;
|
||||||
|
|
||||||
|
- if ((error = fsync(fd))) {
|
||||||
|
- perror("add_j fsync");
|
||||||
|
- goto close_fd;
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+ error = fsync(fd);
|
||||||
|
+ if (error != 0) {
|
||||||
|
+ perror("Failed to sync journal metadata");
|
||||||
|
+ goto close_fd;
|
||||||
|
+ }
|
||||||
|
sprintf(new_name, "journal%u", opts->journals);
|
||||||
|
error = rename2system(opts, opts->jindex, new_name);
|
||||||
|
if (error < 0 && errno != EEXIST){
|
||||||
|
--
|
||||||
|
2.39.0.windows.2
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: gfs2-utils
|
Name: gfs2-utils
|
||||||
Version: 3.4.1
|
Version: 3.4.1
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: Utilities for managing the global file system (GFS2)
|
Summary: Utilities for managing the global file system (GFS2)
|
||||||
|
|
||||||
License: GPLv2+ and LGPLv2+
|
License: GPLv2+ and LGPLv2+
|
||||||
@ -10,6 +10,7 @@ Source0: https://releases.pagure.org/gfs2-utils/gfs2-utils-%{version}.tar
|
|||||||
Patch0: 0001-gfs2-edit-always-use-s-style-format-for-printf-style.patch
|
Patch0: 0001-gfs2-edit-always-use-s-style-format-for-printf-style.patch
|
||||||
Patch1: 0002-fix-error-format-in-gfs2hex.patch
|
Patch1: 0002-fix-error-format-in-gfs2hex.patch
|
||||||
Patch2: 0003-gfs2_jadd-Use-fallocate-to-preallocate-journals.patch
|
Patch2: 0003-gfs2_jadd-Use-fallocate-to-preallocate-journals.patch
|
||||||
|
Patch3: 0004-gfs2_jadd-Don-t-fsync-after-each-block-written.patch
|
||||||
|
|
||||||
BuildRequires: ncurses-devel kernel-headers automake libtool zlib-devel gettext-devel
|
BuildRequires: ncurses-devel kernel-headers automake libtool zlib-devel gettext-devel
|
||||||
BuildRequires: bison flex libblkid-devel libuuid-devel check-devel bzip2-devel make
|
BuildRequires: bison flex libblkid-devel libuuid-devel check-devel bzip2-devel make
|
||||||
@ -55,6 +56,9 @@ rm -f %{buildroot}%{_mandir}/man8/gfs2_lockcapture.8
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jan 9 2023 yaoguangzhong <yaoguangzhong@xfusion.com> - 3.4.1-4
|
||||||
|
- backport gfs2_jadd: don't fsync after each block written
|
||||||
|
|
||||||
* Sat Jan 7 2023 yaoguangzhong <yaoguangzhong@xfusion.com> - 3.4.1-3
|
* Sat Jan 7 2023 yaoguangzhong <yaoguangzhong@xfusion.com> - 3.4.1-3
|
||||||
- backport gfs2_jadd: Use fallocate to preallocate journals
|
- backport gfs2_jadd: Use fallocate to preallocate journals
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user