aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2014-02-19 23:16:39 -0500
committerDave Chinner <david@fromorbit.com>2014-02-19 23:16:39 -0500
commit027f185e66eb24e2ea291ff3b93c1e4bd07b85b4 (patch)
tree6ec052f37d2a0574c4fdf1dc9044982db4d40a8a
parentb678573e29749e7fe884c3a8e61c1cf1e1093987 (diff)
parent9862f62faba8c279ac07415a6f610041116fbdc0 (diff)
Merge remote-tracking branch 'xfs-async-aio-extend' into for-next
-rw-r--r--fs/direct-io.c18
-rw-r--r--fs/xfs/xfs_aops.c3
-rw-r--r--fs/xfs/xfs_iomap.c10
-rw-r--r--include/linux/fs.h3
4 files changed, 20 insertions, 14 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 160a5489a939..a701752dd750 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1194,13 +1194,19 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1194 } 1194 }
1195 1195
1196 /* 1196 /*
1197 * For file extending writes updating i_size before data 1197 * For file extending writes updating i_size before data writeouts
1198 * writeouts complete can expose uninitialized blocks. So 1198 * complete can expose uninitialized blocks in dumb filesystems.
1199 * even for AIO, we need to wait for i/o to complete before 1199 * In that case we need to wait for I/O completion even if asked
1200 * returning in this case. 1200 * for an asynchronous write.
1201 */ 1201 */
1202 dio->is_async = !is_sync_kiocb(iocb) && !((rw & WRITE) && 1202 if (is_sync_kiocb(iocb))
1203 (end > i_size_read(inode))); 1203 dio->is_async = false;
1204 else if (!(dio->flags & DIO_ASYNC_EXTEND) &&
1205 (rw & WRITE) && end > i_size_read(inode))
1206 dio->is_async = false;
1207 else
1208 dio->is_async = true;
1209
1204 dio->inode = inode; 1210 dio->inode = inode;
1205 dio->rw = rw; 1211 dio->rw = rw;
1206 1212
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index db2cfb067d0b..ef62c6b6130a 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1441,7 +1441,8 @@ xfs_vm_direct_IO(
1441 ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iov, 1441 ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iov,
1442 offset, nr_segs, 1442 offset, nr_segs,
1443 xfs_get_blocks_direct, 1443 xfs_get_blocks_direct,
1444 xfs_end_io_direct_write, NULL, 0); 1444 xfs_end_io_direct_write, NULL,
1445 DIO_ASYNC_EXTEND);
1445 if (ret != -EIOCBQUEUED && iocb->private) 1446 if (ret != -EIOCBQUEUED && iocb->private)
1446 goto out_destroy_ioend; 1447 goto out_destroy_ioend;
1447 } else { 1448 } else {
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 22d1cbea283d..3b80ebae05f5 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -128,7 +128,6 @@ xfs_iomap_write_direct(
128 xfs_fsblock_t firstfsb; 128 xfs_fsblock_t firstfsb;
129 xfs_extlen_t extsz, temp; 129 xfs_extlen_t extsz, temp;
130 int nimaps; 130 int nimaps;
131 int bmapi_flag;
132 int quota_flag; 131 int quota_flag;
133 int rt; 132 int rt;
134 xfs_trans_t *tp; 133 xfs_trans_t *tp;
@@ -200,18 +199,15 @@ xfs_iomap_write_direct(
200 199
201 xfs_trans_ijoin(tp, ip, 0); 200 xfs_trans_ijoin(tp, ip, 0);
202 201
203 bmapi_flag = 0;
204 if (offset < XFS_ISIZE(ip) || extsz)
205 bmapi_flag |= XFS_BMAPI_PREALLOC;
206
207 /* 202 /*
208 * From this point onwards we overwrite the imap pointer that the 203 * From this point onwards we overwrite the imap pointer that the
209 * caller gave to us. 204 * caller gave to us.
210 */ 205 */
211 xfs_bmap_init(&free_list, &firstfsb); 206 xfs_bmap_init(&free_list, &firstfsb);
212 nimaps = 1; 207 nimaps = 1;
213 error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb, bmapi_flag, 208 error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
214 &firstfsb, 0, imap, &nimaps, &free_list); 209 XFS_BMAPI_PREALLOC, &firstfsb, 0,
210 imap, &nimaps, &free_list);
215 if (error) 211 if (error)
216 goto out_bmap_cancel; 212 goto out_bmap_cancel;
217 213
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 09f553c59813..f7faefcf4843 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2527,6 +2527,9 @@ enum {
2527 2527
2528 /* filesystem does not support filling holes */ 2528 /* filesystem does not support filling holes */
2529 DIO_SKIP_HOLES = 0x02, 2529 DIO_SKIP_HOLES = 0x02,
2530
2531 /* filesystem can handle aio writes beyond i_size */
2532 DIO_ASYNC_EXTEND = 0x04,
2530}; 2533};
2531 2534
2532void dio_end_io(struct bio *bio, int error); 2535void dio_end_io(struct bio *bio, int error);