gfs2_alloc_required performance
PATCH 1/1 gfs2_alloc_required performance
Hi,
This is a small I/O performance enhancement to gfs2. (Actually, it is a rework of an earlier version I got wrong). The idea here is to check if the write extends past the last block in the file. If so, the function can save itself a lot of time and trouble because it knows an allocate will be required. Benchmarks like iozone should see better performance.
Regards,
Bob Peterson
Red Hat GFS
--
fs/gfs2/bmap.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
fs/gfs2/bmap.c +5 -0
@@ -1224,6 +1224,11 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,unsigned int shift = sdp->sd_sb.sb_bsize_shift; lblock = offset >> shift; lblock_stop = (offset + len + sdp->sd_sb.sb_bsize -1 ) >> shift; +if (lblock_stop > ip->i_di.di_blocks) {/* writing past the +last block */ + *alloc_required =1 ; +return 0 ; + } }for (; lblock < lblock_stop; lblock += extlen) {
PATCH 1/1 gfs2_alloc_required performance
Hi,
Now in the -nmw git tree,
Steve.
Quoted 36 lines · Bob Peterson
Hi,
This is a small I/O performance enhancement to gfs2. (Actually, it is a rework of an earlier version I got wrong). The idea here is to check if the write extends past the last block in the file. If so, the function can save itself a lot of time and trouble because it knows an allocate will be required. Benchmarks like iozone should see better performance.
Regards,
Bob Peterson
Red Hat GFSSigned-off-by Bob Peterson <[email protected]>--
fs/gfs2/bmap.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)fs/gfs2/bmap.c +5
-0@@ -1224,6 +1224,11 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,unsigned int shift = sdp->sd_sb.sb_bsize_shift; lblock = offset >> shift; lblock_stop = (offset + len + sdp->sd_sb.sb_bsize -1 ) >> shift; +if (lblock_stop > ip->i_di.di_blocks) {/* writing past the +last block */ + *alloc_required =1 ; +return 0 ; + } }for (; lblock < lblock_stop; lblock += extlen) {