From fffb64127adc3eea6a19ceefdc88d171f68b9d34 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Thu, 29 Mar 2018 06:50:32 -0700 Subject: gfs2: Zero out fallocated blocks in fallocate_chunk Instead of zeroing out fallocated blocks in gfs2_iomap_alloc, zero them out in fallocate_chunk, much higher up the call stack. This gets rid of gfs2's abuse of the IOMAP_ZERO flag as well as the gfs2 specific zeronew buffer flag. I can't think of a reason why zeroing out the blocks in gfs2_iomap_alloc would have any benefits: there is no additional locking at that level that would add protection to the newly allocated blocks. While at it, change fallocate over from gs2_block_map to gfs2_iomap_begin. Signed-off-by: Andreas Gruenbacher Signed-off-by: Bob Peterson Acked-by: Christoph Hellwig --- fs/gfs2/bmap.c | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'fs/gfs2/bmap.c') diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index ce4a978e0c18..685c305cbeb6 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -491,14 +491,12 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap, { struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); - struct super_block *sb = sdp->sd_vfs; struct buffer_head *dibh = mp->mp_bh[0]; u64 bn; unsigned n, i, blks, alloced = 0, iblks = 0, branch_start = 0; unsigned dblks = 0; unsigned ptrs_per_blk; const unsigned end_of_metadata = mp->mp_fheight - 1; - int ret; enum alloc_state state; __be64 *ptr; __be64 zero_bn = 0; @@ -607,15 +605,6 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap, iomap->flags |= IOMAP_F_NEW; while (n-- > 0) *ptr++ = cpu_to_be64(bn++); - if (flags & IOMAP_ZERO) { - ret = sb_issue_zeroout(sb, iomap->addr >> inode->i_blkbits, - dblks, GFP_NOFS); - if (ret) { - fs_err(sdp, - "Failed to zero data buffers\n"); - flags &= ~IOMAP_ZERO; - } - } break; } } while (iomap->addr == IOMAP_NULL_ADDR); @@ -846,8 +835,6 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, if (create) flags |= IOMAP_WRITE; - if (buffer_zeronew(bh_map)) - flags |= IOMAP_ZERO; ret = gfs2_iomap_begin(inode, (loff_t)lblock << inode->i_blkbits, bh_map->b_size, flags, &iomap); if (ret) { -- cgit v1.2.3