From: Kanchan Joshi <joshi.k@samsung.com> To: axboe@kernel.dk, viro@zeniv.linux.org.uk, bcrl@kvack.org Cc: willy@infradead.org, hch@infradead.org, Damien.LeMoal@wdc.com, asml.silence@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-aio@kvack.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-api@vger.kernel.org, Kanchan Joshi <joshi.k@samsung.com>, Selvakumar S <selvakuma.s1@samsung.com>, Nitesh Shetty <nj.shetty@samsung.com>, Javier Gonzalez <javier.gonz@samsung.com> Subject: [PATCH v4 1/6] fs: introduce FMODE_ZONE_APPEND and IOCB_ZONE_APPEND Date: Fri, 24 Jul 2020 21:19:17 +0530 Message-ID: <1595605762-17010-2-git-send-email-joshi.k@samsung.com> (raw) In-Reply-To: <1595605762-17010-1-git-send-email-joshi.k@samsung.com> Enable zone-append using existing O_APPEND and RWF_APPEND. Zone-append is similar to appending writes, but requires written-location to be returned, in order to be effective. Returning completion-result requires bit of additional processing in common path. Also, we guarantee that zone-append does not cause a short write, which is not the case with regular appending-write. Therefore make the feature opt-in by introducing new FMODE_ZONE_APPEND mode (kernel-only) and IOCB_ZONE_APPEND flag. When a file is opened, it can opt in for zone-append by setting FMODE_ZONE_APPEND. If file has opted in, and receives write that meets file-append criteria (RWF_APPEND write or O_APPEND open), set IOCB_ZONE_APPEND in kiocb->ki_flag, apart from existing IOCB_APPEND. IOCB_ZONE_APPEND is meant to isolate the code that returns written-location with appending write. Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> Signed-off-by: Selvakumar S <selvakuma.s1@samsung.com> Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com> Signed-off-by: Javier Gonzalez <javier.gonz@samsung.com> --- include/linux/fs.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 6c4ab4d..ef13df4 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -175,6 +175,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, /* File does not contribute to nr_files count */ #define FMODE_NOACCOUNT ((__force fmode_t)0x20000000) +/* File can support zone-append */ +#define FMODE_ZONE_APPEND ((__force fmode_t)0x40000000) + /* * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector * that indicates that they should check the contents of the iovec are @@ -315,6 +318,7 @@ enum rw_hint { #define IOCB_SYNC (1 << 5) #define IOCB_WRITE (1 << 6) #define IOCB_NOWAIT (1 << 7) +#define IOCB_ZONE_APPEND (1 << 8) struct kiocb { struct file *ki_filp; @@ -3427,8 +3431,11 @@ static inline bool vma_is_fsdax(struct vm_area_struct *vma) static inline int iocb_flags(struct file *file) { int res = 0; - if (file->f_flags & O_APPEND) + if (file->f_flags & O_APPEND) { res |= IOCB_APPEND; + if (file->f_mode & FMODE_ZONE_APPEND) + res |= IOCB_ZONE_APPEND; + } if (file->f_flags & O_DIRECT) res |= IOCB_DIRECT; if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host)) @@ -3454,8 +3461,11 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags) ki->ki_flags |= IOCB_DSYNC; if (flags & RWF_SYNC) ki->ki_flags |= (IOCB_DSYNC | IOCB_SYNC); - if (flags & RWF_APPEND) + if (flags & RWF_APPEND) { ki->ki_flags |= IOCB_APPEND; + if (ki->ki_filp->f_mode & FMODE_ZONE_APPEND) + ki->ki_flags |= IOCB_ZONE_APPEND; + } return 0; } -- 2.7.4
next prev parent reply index Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20200724155244epcas5p2902f57e36e490ee8772da19aa9408cdc@epcas5p2.samsung.com> 2020-07-24 15:49 ` [PATCH v4 0/6] zone-append support in io-uring and aio Kanchan Joshi [not found] ` <CGME20200724155258epcas5p1a75b926950a18cd1e6c8e7a047e6c589@epcas5p1.samsung.com> 2020-07-24 15:49 ` Kanchan Joshi [this message] 2020-07-24 16:34 ` [PATCH v4 1/6] fs: introduce FMODE_ZONE_APPEND and IOCB_ZONE_APPEND Jens Axboe 2020-07-26 15:18 ` Christoph Hellwig 2020-07-28 1:49 ` Matthew Wilcox 2020-07-28 7:26 ` Christoph Hellwig [not found] ` <CGME20200724155324epcas5p18e1d3b4402d1e4a8eca87d0b56a3fa9b@epcas5p1.samsung.com> 2020-07-24 15:49 ` [PATCH v4 2/6] fs: change ki_complete interface to support 64bit ret2 Kanchan Joshi 2020-07-26 15:18 ` Christoph Hellwig [not found] ` <CGME20200724155329epcas5p345ba6bad0b8fe18056bb4bcd26c10019@epcas5p3.samsung.com> 2020-07-24 15:49 ` [PATCH v4 3/6] uio: return status with iov truncation Kanchan Joshi [not found] ` <CGME20200724155341epcas5p15bfc55927f2abb60f19784270fe8e377@epcas5p1.samsung.com> 2020-07-24 15:49 ` [PATCH v4 4/6] block: add zone append handling for direct I/O path Kanchan Joshi 2020-07-26 15:19 ` Christoph Hellwig [not found] ` <CGME20200724155346epcas5p2cfb383fe9904a45280c6145f4c13e1b4@epcas5p2.samsung.com> 2020-07-24 15:49 ` [PATCH v4 5/6] block: enable zone-append for iov_iter of bvec type Kanchan Joshi 2020-07-26 15:20 ` Christoph Hellwig [not found] ` <CGME20200724155350epcas5p3b8f1d59eda7f8fbb38c828f692d42fd6@epcas5p3.samsung.com> 2020-07-24 15:49 ` [PATCH v4 6/6] io_uring: add support for zone-append Kanchan Joshi 2020-07-24 16:29 ` Jens Axboe 2020-07-27 19:16 ` Kanchan Joshi 2020-07-27 20:34 ` Jens Axboe 2020-07-30 16:08 ` Pavel Begunkov 2020-07-30 16:13 ` Jens Axboe 2020-07-30 16:26 ` Pavel Begunkov 2020-07-30 17:16 ` Jens Axboe 2020-07-30 17:38 ` Pavel Begunkov 2020-07-30 17:51 ` Kanchan Joshi 2020-07-30 17:54 ` Jens Axboe 2020-07-30 18:25 ` Kanchan Joshi 2020-07-31 6:42 ` Damien Le Moal 2020-07-31 6:45 ` hch 2020-07-31 6:59 ` Damien Le Moal 2020-07-31 7:58 ` Kanchan Joshi 2020-07-31 8:14 ` Damien Le Moal 2020-07-31 9:14 ` hch 2020-07-31 9:34 ` Damien Le Moal 2020-07-31 9:41 ` hch 2020-07-31 10:16 ` Damien Le Moal 2020-07-31 12:51 ` hch 2020-07-31 13:08 ` hch 2020-07-31 15:07 ` Kanchan Joshi 2020-08-05 7:35 ` Damien Le Moal 2020-08-14 8:14 ` hch 2020-08-14 8:27 ` Damien Le Moal 2020-08-14 12:04 ` hch 2020-08-14 12:20 ` Damien Le Moal 2020-09-07 7:01 ` Kanchan Joshi 2020-09-08 15:18 ` hch 2020-09-24 17:19 ` Kanchan Joshi 2020-09-25 2:52 ` Damien Le Moal 2020-09-28 18:58 ` Kanchan Joshi 2020-09-29 1:24 ` Damien Le Moal 2020-09-29 18:49 ` Kanchan Joshi 2020-07-31 9:38 ` Kanchan Joshi 2020-07-31 7:08 ` Kanchan Joshi 2020-07-30 15:57 ` Pavel Begunkov
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=1595605762-17010-2-git-send-email-joshi.k@samsung.com \ --to=joshi.k@samsung.com \ --cc=Damien.LeMoal@wdc.com \ --cc=asml.silence@gmail.com \ --cc=axboe@kernel.dk \ --cc=bcrl@kvack.org \ --cc=hch@infradead.org \ --cc=io-uring@vger.kernel.org \ --cc=javier.gonz@samsung.com \ --cc=linux-aio@kvack.org \ --cc=linux-api@vger.kernel.org \ --cc=linux-block@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=nj.shetty@samsung.com \ --cc=selvakuma.s1@samsung.com \ --cc=viro@zeniv.linux.org.uk \ --cc=willy@infradead.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
Linux-api Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-api/0 linux-api/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-api linux-api/ https://lore.kernel.org/linux-api \ linux-api@vger.kernel.org public-inbox-index linux-api Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-api AGPL code for this site: git clone https://public-inbox.org/public-inbox.git