mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
iomap: mark newly allocated buffer heads as new
In iomap_to_bh, not only mark buffer heads in IOMAP_UNWRITTEN maps as new, but also buffer heads in IOMAP_MAPPED maps with the IOMAP_F_NEW flag set. This will be used by filesystems like gfs2, which allocate blocks in iomap->begin. Minor corrections to the comment for IOMAP_UNWRITTEN maps. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
parent
a6d639da63
commit
3d7b6b21f6
@ -1900,15 +1900,16 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
|
|||||||
break;
|
break;
|
||||||
case IOMAP_UNWRITTEN:
|
case IOMAP_UNWRITTEN:
|
||||||
/*
|
/*
|
||||||
* For unwritten regions, we always need to ensure that
|
* For unwritten regions, we always need to ensure that regions
|
||||||
* sub-block writes cause the regions in the block we are not
|
* in the block we are not writing to are zeroed. Mark the
|
||||||
* writing to are zeroed. Set the buffer as new to ensure this.
|
* buffer as new to ensure this.
|
||||||
*/
|
*/
|
||||||
set_buffer_new(bh);
|
set_buffer_new(bh);
|
||||||
set_buffer_unwritten(bh);
|
set_buffer_unwritten(bh);
|
||||||
/* FALLTHRU */
|
/* FALLTHRU */
|
||||||
case IOMAP_MAPPED:
|
case IOMAP_MAPPED:
|
||||||
if (offset >= i_size_read(inode))
|
if ((iomap->flags & IOMAP_F_NEW) ||
|
||||||
|
offset >= i_size_read(inode))
|
||||||
set_buffer_new(bh);
|
set_buffer_new(bh);
|
||||||
bh->b_blocknr = (iomap->addr + offset - iomap->offset) >>
|
bh->b_blocknr = (iomap->addr + offset - iomap->offset) >>
|
||||||
inode->i_blkbits;
|
inode->i_blkbits;
|
||||||
|
Loading…
Reference in New Issue
Block a user