From: Kanchan Joshi <joshi.k@samsung.com>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>,
linux-fsdevel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 2/2] zonefs: use zone-append for AIO as well
Date: Tue, 21 Jul 2020 18:13:43 +0530 [thread overview]
Message-ID: <20200721122724.GA17629@test-zns> (raw)
In-Reply-To: <20200720132118.10934-3-johannes.thumshirn@wdc.com>
[-- Attachment #1: Type: text/plain, Size: 2678 bytes --]
On Mon, Jul 20, 2020 at 10:21:18PM +0900, Johannes Thumshirn wrote:
>If we get an async I/O iocb with an O_APPEND or RWF_APPEND flag set,
>submit it using REQ_OP_ZONE_APPEND to the block layer.
>
>As an REQ_OP_ZONE_APPEND bio must not be split, this does come with an
>additional constraint, namely the buffer submitted to zonefs must not be
>bigger than the max zone append size of the underlying device. For
>synchronous I/O we don't care about this constraint as we can return short
>writes, for AIO we need to return an error on too big buffers.
I wonder what part of the patch implements that constraint on large
buffer and avoids short-write.
Existing code seems to trim iov_iter in the outset.
max = queue_max_zone_append_sectors(bdev_get_queue(bdev));
max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);
iov_iter_truncate(from, max);
This will prevent large-buffer seeing that error, and will lead to partial write.
>On a successful completion, the position the data is written to is
>returned via AIO's res2 field to the calling application.
>
>Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>---
> fs/zonefs/super.c | 143 +++++++++++++++++++++++++++++++++++++++------
> fs/zonefs/zonefs.h | 3 +
> 2 files changed, 128 insertions(+), 18 deletions(-)
>
>diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
>index 5832e9f69268..f155a658675b 100644
>--- a/fs/zonefs/super.c
>+++ b/fs/zonefs/super.c
>@@ -24,6 +24,8 @@
>
> #include "zonefs.h"
>
>+static struct bio_set zonefs_dio_bio_set;
>+
> static inline int zonefs_zone_mgmt(struct zonefs_inode_info *zi,
> enum req_opf op)
> {
>@@ -700,16 +702,71 @@ static const struct iomap_dio_ops zonefs_write_dio_ops = {
> .end_io = zonefs_file_write_dio_end_io,
> };
>
>+struct zonefs_dio {
>+ struct kiocb *iocb;
>+ struct task_struct *waiter;
>+ int error;
>+ struct work_struct work;
>+ size_t size;
>+ u64 sector;
>+ struct completion completion;
>+ struct bio bio;
>+};
How about this (will save 32 bytes) -
+struct zonefs_dio {
+ struct kiocb *iocb;
+ struct task_struct *waiter;
+ int error;
+ union {
+ struct work_struct work; //only for async IO
+ struct completion completion; //only for sync IO
+ };
+ size_t size;
+ u64 sector;
+ struct bio bio;
+};
And dio->error field is not required.
I see it being used at one place -
+ ret = zonefs_file_write_dio_end_io(iocb, dio->size,
+ dio->error, 0);
Here error-code can be picked from dio->bio.
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2020-07-21 13:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-20 13:21 [PATCH 0/2] zonefs: use zone-append for aio with rwf append Johannes Thumshirn
2020-07-20 13:21 ` [PATCH 1/2] fs: fix kiocb ki_complete interface Johannes Thumshirn
2020-07-20 13:38 ` Christoph Hellwig
2020-07-20 13:43 ` Damien Le Moal
2020-07-20 13:47 ` Christoph Hellwig
2020-07-20 13:21 ` [PATCH 2/2] zonefs: use zone-append for AIO as well Johannes Thumshirn
2020-07-20 13:45 ` Christoph Hellwig
2020-07-20 16:48 ` Johannes Thumshirn
2020-07-21 5:54 ` Christoph Hellwig
2020-07-22 12:43 ` Johannes Thumshirn
2020-07-22 13:02 ` Damien Le Moal
2020-07-22 14:53 ` Christoph Hellwig
2020-07-22 14:51 ` Christoph Hellwig
2020-07-22 15:00 ` Johannes Thumshirn
2020-07-24 13:57 ` Kanchan Joshi
2020-07-27 3:12 ` Damien Le Moal
2020-07-21 12:43 ` Kanchan Joshi [this message]
2020-07-22 14:32 ` Johannes Thumshirn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200721122724.GA17629@test-zns \
--to=joshi.k@samsung.com \
--cc=Damien.LeMoal@wdc.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).