aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2015-04-16 07:57:48 -0400
committerDave Chinner <david@fromorbit.com>2015-04-16 07:57:48 -0400
commita719370be52d1152a5f6e19c4af3b73280e25475 (patch)
treed057061f41c13452b930315374abf44467ac1e85 /fs/xfs
parentc517d838eb7d07bbe9507871fab3931deccff539 (diff)
xfs: factor DIO write mapping from get_blocks
Clarify and separate the buffer mapping logic so that the direct IO mapping is not tangled up in propagating the extent status to teh mapping buffer. This makes it easier to extend the direct IO mapping to use an ioend in future. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_aops.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 3a9b7a1b8704..489ed200bbbb 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1233,6 +1233,22 @@ xfs_vm_releasepage(
1233 return try_to_free_buffers(page); 1233 return try_to_free_buffers(page);
1234} 1234}
1235 1235
1236/*
1237 * do all the direct IO specific mapping buffer manipulation here.
1238 */
1239static void
1240xfs_map_direct(
1241 struct inode *inode,
1242 struct buffer_head *bh_result,
1243 struct xfs_bmbt_irec *imap,
1244 xfs_off_t offset)
1245{
1246 if (ISUNWRITTEN(imap)) {
1247 bh_result->b_private = inode;
1248 set_buffer_defer_completion(bh_result);
1249 }
1250}
1251
1236STATIC int 1252STATIC int
1237__xfs_get_blocks( 1253__xfs_get_blocks(
1238 struct inode *inode, 1254 struct inode *inode,
@@ -1331,21 +1347,19 @@ __xfs_get_blocks(
1331 goto out_unlock; 1347 goto out_unlock;
1332 } 1348 }
1333 1349
1350 /*
1351 * For unwritten extents do not report a disk address in the buffered
1352 * read case (treat as if we're reading into a hole).
1353 */
1334 if (imap.br_startblock != HOLESTARTBLOCK && 1354 if (imap.br_startblock != HOLESTARTBLOCK &&
1335 imap.br_startblock != DELAYSTARTBLOCK) { 1355 imap.br_startblock != DELAYSTARTBLOCK &&
1336 /* 1356 (create || !ISUNWRITTEN(&imap))) {
1337 * For unwritten extents do not report a disk address on 1357 xfs_map_buffer(inode, bh_result, &imap, offset);
1338 * the read case (treat as if we're reading into a hole). 1358 if (ISUNWRITTEN(&imap))
1339 */
1340 if (create || !ISUNWRITTEN(&imap))
1341 xfs_map_buffer(inode, bh_result, &imap, offset);
1342 if (create && ISUNWRITTEN(&imap)) {
1343 if (direct) {
1344 bh_result->b_private = inode;
1345 set_buffer_defer_completion(bh_result);
1346 }
1347 set_buffer_unwritten(bh_result); 1359 set_buffer_unwritten(bh_result);
1348 } 1360 /* direct IO needs special help */
1361 if (create && direct)
1362 xfs_map_direct(inode, bh_result, &imap, offset);
1349 } 1363 }
1350 1364
1351 /* 1365 /*