From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: "Jürg Billeter" <j@bitron.ch>, "Al Viro" <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH] fs: add RWF_APPEND
Date: Sat, 30 Sep 2017 19:31:58 -0500 [thread overview]
Message-ID: <5b26363b-e2cf-294e-728a-640d7820d9ae@suse.de> (raw)
In-Reply-To: <20170929120717.47515-1-j@bitron.ch>
On 09/29/2017 07:07 AM, Jürg Billeter wrote:
> This is the per-I/O equivalent of O_APPEND to support atomic append
> operations on any open file.
>
> If a file is opened with O_APPEND, pwrite() ignores the offset and
> always appends data to the end of the file. RWF_APPEND enables atomic
> append and pwrite() with offset on a single file descriptor.
>
I think similarly we can introduce RWF_DIRECT, though I am not sure if
users would want to mix buffered writes and direct writes.
Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> Signed-off-by: Jürg Billeter <j@bitron.ch>
> ---
> include/linux/fs.h | 2 ++
> include/uapi/linux/fs.h | 6 +++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 339e73742e73..fee24eae7523 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3204,6 +3204,8 @@ 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)
> + ki->ki_flags |= IOCB_APPEND;
> return 0;
> }
>
> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
> index 56235dddea7d..ac145430bcd8 100644
> --- a/include/uapi/linux/fs.h
> +++ b/include/uapi/linux/fs.h
> @@ -376,7 +376,11 @@ typedef int __bitwise __kernel_rwf_t;
> /* per-IO, return -EAGAIN if operation would block */
> #define RWF_NOWAIT ((__force __kernel_rwf_t)0x00000008)
>
> +/* per-IO O_APPEND */
> +#define RWF_APPEND ((__force __kernel_rwf_t)0x00000010)
> +
> /* mask of flags supported by the kernel */
> -#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT)
> +#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
> + RWF_APPEND)
>
> #endif /* _UAPI_LINUX_FS_H */
>
--
Goldwyn
next prev parent reply other threads:[~2017-10-01 0:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 12:07 Jürg Billeter
2017-10-01 0:31 ` Goldwyn Rodrigues [this message]
2017-10-01 8:20 ` Christoph Hellwig
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=5b26363b-e2cf-294e-728a-640d7820d9ae@suse.de \
--to=rgoldwyn@suse.de \
--cc=j@bitron.ch \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
Powered by JetHome