* [PATCH 0/3] support appending AIO writes
@ 2014-02-04 17:24 Christoph Hellwig
2014-02-04 17:24 ` [PATCH 1/3] direct-io: add flag to allow aio writes beyond i_size Christoph Hellwig
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Christoph Hellwig @ 2014-02-04 17:24 UTC (permalink / raw)
To: xfs, linux-fsdevel; +Cc: Sergey Meirovich
At least XFS can support appending AIO writes easily, and Sergey has
demonstrated a use case for them.
I've not done any performance testing myself, but ensured that xfstests
already exercises the code path.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3] direct-io: add flag to allow aio writes beyond i_size
2014-02-04 17:24 [PATCH 0/3] support appending AIO writes Christoph Hellwig
@ 2014-02-04 17:24 ` Christoph Hellwig
2014-02-04 17:24 ` [PATCH 2/3] xfs: always use unwritten extents for direct I/O writes Christoph Hellwig
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2014-02-04 17:24 UTC (permalink / raw)
To: xfs, linux-fsdevel; +Cc: Sergey Meirovich
[-- Attachment #1: 0001-direct-io-add-flag-to-allow-aio-writes-beyond-i_size.patch --]
[-- Type: text/plain, Size: 1701 bytes --]
Some filesystems can handle direct I/O writes beyond i_size safely,
so allow them to opt into receiving them.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/direct-io.c | 18 ++++++++++++------
include/linux/fs.h | 3 +++
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 0e04142..11882e8 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,
}
/*
- * For file extending writes updating i_size before data
- * writeouts complete can expose uninitialized blocks. So
- * even for AIO, we need to wait for i/o to complete before
- * returning in this case.
+ * For file extending writes updating i_size before data writeouts
+ * complete can expose uninitialized blocks in dumb filesystems.
+ * In that case we need to wait for I/O completion even if asked
+ * for an asynchronous write.
*/
- dio->is_async = !is_sync_kiocb(iocb) && !((rw & WRITE) &&
- (end > i_size_read(inode)));
+ if (is_sync_kiocb(iocb))
+ dio->is_async = false;
+ else if (!(dio->flags & DIO_ASYNC_EXTEND) &&
+ (rw & WRITE) && end > i_size_read(inode))
+ dio->is_async = false;
+ else
+ dio->is_async = true;
+
dio->inode = inode;
dio->rw = rw;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 121f11f..f8416fd 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2526,6 +2526,9 @@ enum {
/* filesystem does not support filling holes */
DIO_SKIP_HOLES = 0x02,
+
+ /* filesystem can handle aio writes beyond i_size */
+ DIO_ASYNC_EXTEND = 0x04,
};
void dio_end_io(struct bio *bio, int error);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] xfs: always use unwritten extents for direct I/O writes
2014-02-04 17:24 [PATCH 0/3] support appending AIO writes Christoph Hellwig
2014-02-04 17:24 ` [PATCH 1/3] direct-io: add flag to allow aio writes beyond i_size Christoph Hellwig
@ 2014-02-04 17:24 ` Christoph Hellwig
2014-02-04 17:24 ` [PATCH 3/3] xfs: allow appending aio writes Christoph Hellwig
` (2 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2014-02-04 17:24 UTC (permalink / raw)
To: xfs, linux-fsdevel; +Cc: Sergey Meirovich
[-- Attachment #1: 0002-xfs-always-use-unwritten-extents-for-direct-I-O-writ.patch --]
[-- Type: text/plain, Size: 1447 bytes --]
To allow aio writes beyond i_size we need to create unwritten extents for
newly allocated blocks, similar to how we already do inside i_size.
Instead of adding another special case we now use unwritten extents
unconditionally. This also marks the end of directly allocation data
extents in all of XFS - we now always use either delalloc or unwritten
extents.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_iomap.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 22d1cbe..3b80eba 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -128,7 +128,6 @@ xfs_iomap_write_direct(
xfs_fsblock_t firstfsb;
xfs_extlen_t extsz, temp;
int nimaps;
- int bmapi_flag;
int quota_flag;
int rt;
xfs_trans_t *tp;
@@ -200,18 +199,15 @@ xfs_iomap_write_direct(
xfs_trans_ijoin(tp, ip, 0);
- bmapi_flag = 0;
- if (offset < XFS_ISIZE(ip) || extsz)
- bmapi_flag |= XFS_BMAPI_PREALLOC;
-
/*
* From this point onwards we overwrite the imap pointer that the
* caller gave to us.
*/
xfs_bmap_init(&free_list, &firstfsb);
nimaps = 1;
- error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb, bmapi_flag,
- &firstfsb, 0, imap, &nimaps, &free_list);
+ error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
+ XFS_BMAPI_PREALLOC, &firstfsb, 0,
+ imap, &nimaps, &free_list);
if (error)
goto out_bmap_cancel;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] xfs: allow appending aio writes
2014-02-04 17:24 [PATCH 0/3] support appending AIO writes Christoph Hellwig
2014-02-04 17:24 ` [PATCH 1/3] direct-io: add flag to allow aio writes beyond i_size Christoph Hellwig
2014-02-04 17:24 ` [PATCH 2/3] xfs: always use unwritten extents for direct I/O writes Christoph Hellwig
@ 2014-02-04 17:24 ` Christoph Hellwig
2014-02-04 22:29 ` [PATCH 0/3] support appending AIO writes Dave Chinner
2014-02-05 14:52 ` Sergey Meirovich
4 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2014-02-04 17:24 UTC (permalink / raw)
To: xfs, linux-fsdevel; +Cc: Sergey Meirovich
[-- Attachment #1: 0003-xfs-allow-appending-aio-writes.patch --]
[-- Type: text/plain, Size: 831 bytes --]
XFS can easily support appending aio writes by ensuring we always allocate
blocks as unwritten extents when performing direct I/O writes and only
converting them to written extents at I/O completion.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_aops.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index a267394..a4278e4 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1441,7 +1441,8 @@ xfs_vm_direct_IO(
ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iov,
offset, nr_segs,
xfs_get_blocks_direct,
- xfs_end_io_direct_write, NULL, 0);
+ xfs_end_io_direct_write, NULL,
+ DIO_ASYNC_EXTEND);
if (ret != -EIOCBQUEUED && iocb->private)
goto out_destroy_ioend;
} else {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] support appending AIO writes
2014-02-04 17:24 [PATCH 0/3] support appending AIO writes Christoph Hellwig
` (2 preceding siblings ...)
2014-02-04 17:24 ` [PATCH 3/3] xfs: allow appending aio writes Christoph Hellwig
@ 2014-02-04 22:29 ` Dave Chinner
2014-02-05 6:57 ` Christoph Hellwig
2014-02-05 14:52 ` Sergey Meirovich
4 siblings, 1 reply; 12+ messages in thread
From: Dave Chinner @ 2014-02-04 22:29 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-fsdevel, Sergey Meirovich, xfs
On Tue, Feb 04, 2014 at 09:24:02AM -0800, Christoph Hellwig wrote:
> At least XFS can support appending AIO writes easily, and Sergey has
> demonstrated a use case for them.
>
> I've not done any performance testing myself, but ensured that xfstests
> already exercises the code path.
The patches look sane. Does the dio change conflict with the
work Al is doing right now of the direct IO path, or will
marshalling that part of the change through the XFS tree be fine?
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] support appending AIO writes
2014-02-04 22:29 ` [PATCH 0/3] support appending AIO writes Dave Chinner
@ 2014-02-05 6:57 ` Christoph Hellwig
2014-02-05 7:59 ` Dave Chinner
2014-02-05 13:55 ` Al Viro
0 siblings, 2 replies; 12+ messages in thread
From: Christoph Hellwig @ 2014-02-05 6:57 UTC (permalink / raw)
To: Dave Chinner; +Cc: Christoph Hellwig, linux-fsdevel, Sergey Meirovich, xfs
On Wed, Feb 05, 2014 at 09:29:01AM +1100, Dave Chinner wrote:
> The patches look sane. Does the dio change conflict with the
> work Al is doing right now of the direct IO path, or will
> marshalling that part of the change through the XFS tree be fine?
I've not seen any changes in that area in Al's trees. That being said
I don't think this little flag should cause any major problems as we'll
have to pass the flags argument in some form of direct I/O method for
all the other quirks we have.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] support appending AIO writes
2014-02-05 6:57 ` Christoph Hellwig
@ 2014-02-05 7:59 ` Dave Chinner
2014-02-05 13:55 ` Al Viro
1 sibling, 0 replies; 12+ messages in thread
From: Dave Chinner @ 2014-02-05 7:59 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-fsdevel, Sergey Meirovich, xfs
On Tue, Feb 04, 2014 at 10:57:28PM -0800, Christoph Hellwig wrote:
> On Wed, Feb 05, 2014 at 09:29:01AM +1100, Dave Chinner wrote:
> > The patches look sane. Does the dio change conflict with the
> > work Al is doing right now of the direct IO path, or will
> > marshalling that part of the change through the XFS tree be fine?
>
> I've not seen any changes in that area in Al's trees. That being said
> I don't think this little flag should cause any major problems as we'll
> have to pass the flags argument in some form of direct I/O method for
> all the other quirks we have.
Fair enough. I'll run some tests tomorrow on it and go from there.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] support appending AIO writes
2014-02-05 6:57 ` Christoph Hellwig
2014-02-05 7:59 ` Dave Chinner
@ 2014-02-05 13:55 ` Al Viro
1 sibling, 0 replies; 12+ messages in thread
From: Al Viro @ 2014-02-05 13:55 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-fsdevel, Sergey Meirovich, xfs
On Tue, Feb 04, 2014 at 10:57:28PM -0800, Christoph Hellwig wrote:
> On Wed, Feb 05, 2014 at 09:29:01AM +1100, Dave Chinner wrote:
> > The patches look sane. Does the dio change conflict with the
> > work Al is doing right now of the direct IO path, or will
> > marshalling that part of the change through the XFS tree be fine?
>
> I've not seen any changes in that area in Al's trees. That being said
> I don't think this little flag should cause any major problems as we'll
> have to pass the flags argument in some form of direct I/O method for
> all the other quirks we have.
Shouldn't be a problem; there might be textual conflicts, but seeing that
XFS tree is much less likely to be rebased, I can just pull from it once
it gets to those.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] support appending AIO writes
2014-02-04 17:24 [PATCH 0/3] support appending AIO writes Christoph Hellwig
` (3 preceding siblings ...)
2014-02-04 22:29 ` [PATCH 0/3] support appending AIO writes Dave Chinner
@ 2014-02-05 14:52 ` Sergey Meirovich
2014-02-06 16:29 ` Sergey Meirovich
4 siblings, 1 reply; 12+ messages in thread
From: Sergey Meirovich @ 2014-02-05 14:52 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-fsdevel, xfs
Hi Christoph,
Thanks a lot! Applied your patches on top of 3.13.1 and they indeed
make a huge difference.
Append AIO
chunk size w/o patches with patches
===================================================
4k 6.8834 Mb/sec 1762.15 IOps 31.542 Mb/sec 8074.75 IOps
8k 15.321 Mb/sec 1961.12 IOps 62.873 Mb/sec 8047.71 IOps
16k 28.257 Mb/sec 1808.46 IOps 139.35 Mb/sec 8918.45 IOps
On 4 February 2014 19:24, Christoph Hellwig <hch@infradead.org> wrote:
> At least XFS can support appending AIO writes easily, and Sergey has
> demonstrated a use case for them.
>
> I've not done any performance testing myself, but ensured that xfstests
> already exercises the code path.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] support appending AIO writes
2014-02-05 14:52 ` Sergey Meirovich
@ 2014-02-06 16:29 ` Sergey Meirovich
2014-02-06 22:51 ` Dave Chinner
0 siblings, 1 reply; 12+ messages in thread
From: Sergey Meirovich @ 2014-02-06 16:29 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs, linux-fsdevel
On 5 February 2014 16:52, Sergey Meirovich <rathamahata@gmail.com> wrote:
> Hi Christoph,
>
> Thanks a lot! Applied your patches on top of 3.13.1 and they indeed
> make a huge difference.
>
>
> Append AIO
>
> chunk size w/o patches with patches
> ===================================================
> 4k 6.8834 Mb/sec 1762.15 IOps 31.542 Mb/sec 8074.75 IOps
> 8k 15.321 Mb/sec 1961.12 IOps 62.873 Mb/sec 8047.71 IOps
> 16k 28.257 Mb/sec 1808.46 IOps 139.35 Mb/sec 8918.45 IOps
And with simple wrapper around io_submit() difference for 4 k is even
more impressive than with sysbench:
without patches:
=====================
bandwidth (MiB/s): 11.89
IOps: 3044.58
with patches:
=====================
bandwidth (MiB/s): 118.16
IOps: 30250.17
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] support appending AIO writes
2014-02-06 16:29 ` Sergey Meirovich
@ 2014-02-06 22:51 ` Dave Chinner
2014-02-07 9:40 ` Sergey Meirovich
0 siblings, 1 reply; 12+ messages in thread
From: Dave Chinner @ 2014-02-06 22:51 UTC (permalink / raw)
To: Sergey Meirovich; +Cc: Christoph Hellwig, linux-fsdevel, xfs
On Thu, Feb 06, 2014 at 06:29:11PM +0200, Sergey Meirovich wrote:
> On 5 February 2014 16:52, Sergey Meirovich <rathamahata@gmail.com> wrote:
> > Hi Christoph,
> >
> > Thanks a lot! Applied your patches on top of 3.13.1 and they indeed
> > make a huge difference.
> >
> >
> > Append AIO
> >
> > chunk size w/o patches with patches
> > ===================================================
> > 4k 6.8834 Mb/sec 1762.15 IOps 31.542 Mb/sec 8074.75 IOps
> > 8k 15.321 Mb/sec 1961.12 IOps 62.873 Mb/sec 8047.71 IOps
> > 16k 28.257 Mb/sec 1808.46 IOps 139.35 Mb/sec 8918.45 IOps
>
> And with simple wrapper around io_submit() difference for 4 k is even
> more impressive than with sysbench:
>
> without patches:
> =====================
> bandwidth (MiB/s): 11.89
> IOps: 3044.58
>
> with patches:
> =====================
> bandwidth (MiB/s): 118.16
> IOps: 30250.17
Thanks for providing numbers, Sergey. It's clear that we need to
make this change from them. Can I add a "Tested-by: Sergey Meirovich
<rathamahata@gmail.com>" to the patches?
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] support appending AIO writes
2014-02-06 22:51 ` Dave Chinner
@ 2014-02-07 9:40 ` Sergey Meirovich
0 siblings, 0 replies; 12+ messages in thread
From: Sergey Meirovich @ 2014-02-07 9:40 UTC (permalink / raw)
To: Dave Chinner; +Cc: Christoph Hellwig, linux-fsdevel, xfs
On 7 February 2014 00:51, Dave Chinner <david@fromorbit.com> wrote:
> On Thu, Feb 06, 2014 at 06:29:11PM +0200, Sergey Meirovich wrote:
>> On 5 February 2014 16:52, Sergey Meirovich <rathamahata@gmail.com> wrote:
>> > Hi Christoph,
>> >
>> > Thanks a lot! Applied your patches on top of 3.13.1 and they indeed
>> > make a huge difference.
>> >
>> >
>> > Append AIO
>> >
>> > chunk size w/o patches with patches
>> > ===================================================
>> > 4k 6.8834 Mb/sec 1762.15 IOps 31.542 Mb/sec 8074.75 IOps
>> > 8k 15.321 Mb/sec 1961.12 IOps 62.873 Mb/sec 8047.71 IOps
>> > 16k 28.257 Mb/sec 1808.46 IOps 139.35 Mb/sec 8918.45 IOps
>>
>> And with simple wrapper around io_submit() difference for 4 k is even
>> more impressive than with sysbench:
>>
>> without patches:
>> =====================
>> bandwidth (MiB/s): 11.89
>> IOps: 3044.58
>>
>> with patches:
>> =====================
>> bandwidth (MiB/s): 118.16
>> IOps: 30250.17
>
> Thanks for providing numbers, Sergey. It's clear that we need to
> make this change from them. Can I add a "Tested-by: Sergey Meirovich
> <rathamahata@gmail.com>" to the patches?
Sure, Dave. Please do.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-02-07 9:40 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-04 17:24 [PATCH 0/3] support appending AIO writes Christoph Hellwig
2014-02-04 17:24 ` [PATCH 1/3] direct-io: add flag to allow aio writes beyond i_size Christoph Hellwig
2014-02-04 17:24 ` [PATCH 2/3] xfs: always use unwritten extents for direct I/O writes Christoph Hellwig
2014-02-04 17:24 ` [PATCH 3/3] xfs: allow appending aio writes Christoph Hellwig
2014-02-04 22:29 ` [PATCH 0/3] support appending AIO writes Dave Chinner
2014-02-05 6:57 ` Christoph Hellwig
2014-02-05 7:59 ` Dave Chinner
2014-02-05 13:55 ` Al Viro
2014-02-05 14:52 ` Sergey Meirovich
2014-02-06 16:29 ` Sergey Meirovich
2014-02-06 22:51 ` Dave Chinner
2014-02-07 9:40 ` Sergey Meirovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).