diff options
Diffstat (limited to 'fs/gfs2/bmap.c')
-rw-r--r-- | fs/gfs2/bmap.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 834cd9442a1d..97b61955850a 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
11 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
12 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
13 | #include <linux/blkdev.h> | ||
13 | #include <linux/gfs2_ondisk.h> | 14 | #include <linux/gfs2_ondisk.h> |
14 | #include <linux/crc32.h> | 15 | #include <linux/crc32.h> |
15 | 16 | ||
@@ -427,12 +428,14 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
427 | { | 428 | { |
428 | struct gfs2_inode *ip = GFS2_I(inode); | 429 | struct gfs2_inode *ip = GFS2_I(inode); |
429 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 430 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
431 | struct super_block *sb = sdp->sd_vfs; | ||
430 | struct buffer_head *dibh = mp->mp_bh[0]; | 432 | struct buffer_head *dibh = mp->mp_bh[0]; |
431 | u64 bn, dblock = 0; | 433 | u64 bn, dblock = 0; |
432 | unsigned n, i, blks, alloced = 0, iblks = 0, branch_start = 0; | 434 | unsigned n, i, blks, alloced = 0, iblks = 0, branch_start = 0; |
433 | unsigned dblks = 0; | 435 | unsigned dblks = 0; |
434 | unsigned ptrs_per_blk; | 436 | unsigned ptrs_per_blk; |
435 | const unsigned end_of_metadata = height - 1; | 437 | const unsigned end_of_metadata = height - 1; |
438 | int ret; | ||
436 | int eob = 0; | 439 | int eob = 0; |
437 | enum alloc_state state; | 440 | enum alloc_state state; |
438 | __be64 *ptr; | 441 | __be64 *ptr; |
@@ -535,6 +538,15 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
535 | dblock = bn; | 538 | dblock = bn; |
536 | while (n-- > 0) | 539 | while (n-- > 0) |
537 | *ptr++ = cpu_to_be64(bn++); | 540 | *ptr++ = cpu_to_be64(bn++); |
541 | if (buffer_zeronew(bh_map)) { | ||
542 | ret = sb_issue_zeroout(sb, dblock, dblks, | ||
543 | GFP_NOFS); | ||
544 | if (ret) { | ||
545 | fs_err(sdp, | ||
546 | "Failed to zero data buffers\n"); | ||
547 | clear_buffer_zeronew(bh_map); | ||
548 | } | ||
549 | } | ||
538 | break; | 550 | break; |
539 | } | 551 | } |
540 | } while ((state != ALLOC_DATA) || !dblock); | 552 | } while ((state != ALLOC_DATA) || !dblock); |