Commit ecff71e6 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder

xfs: simplify xfs_map_at_offset

Move the buffer locking into the callers as they need to do it
wether they call xfs_map_at_offset or not.  Remove the b_bdev
assignment, which is already done by get_blocks.  Remove the
duplicate extent type asserts in xfs_convert_page just before
calling xfs_map_at_offset.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent aeea1b1f
...@@ -626,9 +626,7 @@ xfs_map_at_offset( ...@@ -626,9 +626,7 @@ xfs_map_at_offset(
ASSERT(imap->br_startblock != HOLESTARTBLOCK); ASSERT(imap->br_startblock != HOLESTARTBLOCK);
ASSERT(imap->br_startblock != DELAYSTARTBLOCK); ASSERT(imap->br_startblock != DELAYSTARTBLOCK);
lock_buffer(bh);
xfs_map_buffer(inode, bh, imap, offset); xfs_map_buffer(inode, bh, imap, offset);
bh->b_bdev = xfs_find_bdev_for_inode(inode);
set_buffer_mapped(bh); set_buffer_mapped(bh);
clear_buffer_delay(bh); clear_buffer_delay(bh);
clear_buffer_unwritten(bh); clear_buffer_unwritten(bh);
...@@ -751,12 +749,8 @@ xfs_convert_page( ...@@ -751,12 +749,8 @@ xfs_convert_page(
continue; continue;
} }
ASSERT(imap->br_startblock != HOLESTARTBLOCK); lock_buffer(bh);
ASSERT(imap->br_startblock != DELAYSTARTBLOCK); if (type != IO_OVERWRITE)
if (type == IO_OVERWRITE)
lock_buffer(bh);
else
xfs_map_at_offset(inode, bh, imap, offset); xfs_map_at_offset(inode, bh, imap, offset);
xfs_add_to_ioend(inode, bh, offset, type, xfs_add_to_ioend(inode, bh, offset, type,
ioendp, done); ioendp, done);
...@@ -1041,9 +1035,8 @@ xfs_vm_writepage( ...@@ -1041,9 +1035,8 @@ xfs_vm_writepage(
imap_valid = xfs_imap_valid(inode, &imap, offset); imap_valid = xfs_imap_valid(inode, &imap, offset);
} }
if (imap_valid) { if (imap_valid) {
if (type == IO_OVERWRITE) lock_buffer(bh);
lock_buffer(bh); if (type != IO_OVERWRITE)
else
xfs_map_at_offset(inode, bh, &imap, offset); xfs_map_at_offset(inode, bh, &imap, offset);
xfs_add_to_ioend(inode, bh, offset, type, &ioend, xfs_add_to_ioend(inode, bh, offset, type, &ioend,
new_ioend); new_ioend);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment