This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 7f8ece48708594e4aecceb096942e4db7562a1c7
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Jun 5 16:39:02 2019 +0100
libgfs2: Speed up bread()
While bread() is still used in many hard-to-refactor places it should be
as performant as possible. Implementing it in terms of breadm() adds
extra iovec allocation overhead so simplify it by implementing it with a
simpler bget() and pread().
This only shows a 0.5% speed up in testing but that scales up to an hour
off a 300TB fsck.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/buf.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/gfs2/libgfs2/buf.c b/gfs2/libgfs2/buf.c
index 92cd393..097ac33 100644
--- a/gfs2/libgfs2/buf.c
+++ b/gfs2/libgfs2/buf.c
@@ -77,12 +77,20 @@ struct gfs2_buffer_head *__bread(struct gfs2_sbd *sdp, uint64_t num,
int line,
const char *caller)
{
struct gfs2_buffer_head *bh;
- int ret;
+ ssize_t ret;
- ret = __breadm(sdp, &bh, 1, num, line, caller);
- if (ret >= 0)
- return bh;
- return NULL;
+ bh = bget(sdp, num);
+ if (bh == NULL)
+ return NULL;
+
+ ret = pread(sdp->device_fd, bh->b_data, sdp->bsize, num * sdp->bsize);
+ if (ret != sdp->bsize) {
+ fprintf(stderr, "%s:%d: Error reading block %"PRIu64": %s\n",
+ caller, line, num, strerror(errno));
+ free(bh);
+ bh = NULL;
+ }
+ return bh;
}
int bwrite(struct gfs2_buffer_head *bh)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date