gfs2: Iomap cleanups and improvements
Clean up gfs2_iomap_alloc and gfs2_iomap_get. Document how gfs2_iomap_alloc works: it now needs to be called separately after gfs2_iomap_get where necessary; this will be used later by iomap write. Move gfs2_iomap_ops into bmap.c. Introduce a new gfs2_iomap_get_alloc helper and use it in fallocate_chunk: gfs2_iomap_begin will become unsuitable for fallocate with proper iomap write support. In gfs2_block_map and fallocate_chunk, zero-initialize struct iomap. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
This commit is contained in:

committed by
Bob Peterson

parent
845802b112
commit
628e366df1
@@ -733,7 +733,7 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
loff_t end = offset + len;
|
||||
struct buffer_head *dibh;
|
||||
struct iomap iomap;
|
||||
struct iomap iomap = { };
|
||||
int error;
|
||||
|
||||
error = gfs2_meta_inode_buffer(ip, &dibh);
|
||||
@@ -749,8 +749,8 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
|
||||
}
|
||||
|
||||
while (offset < end) {
|
||||
error = gfs2_iomap_begin(inode, offset, end - offset,
|
||||
IOMAP_WRITE, &iomap);
|
||||
error = gfs2_iomap_get_alloc(inode, offset, end - offset,
|
||||
&iomap);
|
||||
if (error)
|
||||
goto out;
|
||||
offset = iomap.offset + iomap.length;
|
||||
|
Reference in New Issue
Block a user