From: Christoph Hellwig <hch@lst.de>
To: viro@zeniv.linux.org.uk, axboe@fb.com
Cc: milosz@adfin.com, linux-fsdevel@vger.kernel.org,
linux-block@vger.kernel.org, linux-api@vger.kernel.org
Subject: [PATCH 4/6] vfs: add the RWF_HIPRI flag for preadv2/pwritev2
Date: Thu, 3 Mar 2016 16:04:01 +0100 [thread overview]
Message-ID: <1457017443-17662-5-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1457017443-17662-1-git-send-email-hch@lst.de>
This adds a flag that tells the file system that this is a high priority
request for which it's worth to poll the hardware. The flag is purely
advisory and can be ignored if not supported.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Stephen Bates <stephen.bates@pmcs.com>
Tested-by: Stephen Bates <stephen.bates@pmcs.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
---
fs/read_write.c | 6 ++++--
include/linux/fs.h | 1 +
include/uapi/linux/fs.h | 3 +++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/read_write.c b/fs/read_write.c
index 799d25f..cf377cf 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -698,10 +698,12 @@ static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter,
struct kiocb kiocb;
ssize_t ret;
- if (flags)
+ if (flags & ~RWF_HIPRI)
return -EOPNOTSUPP;
init_sync_kiocb(&kiocb, filp);
+ if (flags & RWF_HIPRI)
+ kiocb.ki_flags |= IOCB_HIPRI;
kiocb.ki_pos = *ppos;
ret = fn(&kiocb, iter);
@@ -716,7 +718,7 @@ static ssize_t do_loop_readv_writev(struct file *filp, struct iov_iter *iter,
{
ssize_t ret = 0;
- if (flags)
+ if (flags & ~RWF_HIPRI)
return -EOPNOTSUPP;
while (iov_iter_count(iter)) {
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 875277a..a1f731c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -320,6 +320,7 @@ struct writeback_control;
#define IOCB_EVENTFD (1 << 0)
#define IOCB_APPEND (1 << 1)
#define IOCB_DIRECT (1 << 2)
+#define IOCB_HIPRI (1 << 3)
struct kiocb {
struct file *ki_filp;
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 149bec8..d246339 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -304,4 +304,7 @@ struct fsxattr {
#define SYNC_FILE_RANGE_WRITE 2
#define SYNC_FILE_RANGE_WAIT_AFTER 4
+/* flags for preadv2/pwritev2: */
+#define RWF_HIPRI 0x00000001 /* high priority request, poll if possible */
+
#endif /* _UAPI_LINUX_FS_H */
--
2.1.4
next prev parent reply other threads:[~2016-03-03 15:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 15:03 generic RDMA READ/WRITE API V2 Christoph Hellwig
2016-03-03 15:03 ` [PATCH 1/6] vfs: pass a flags argument to vfs_readv/vfs_writev Christoph Hellwig
2016-03-03 15:03 ` [PATCH 2/6] vfs: vfs: Define new syscalls preadv2,pwritev2 Christoph Hellwig
2016-03-10 18:15 ` Michael Kerrisk (man-pages)
2016-03-11 9:53 ` Christoph Hellwig
2016-04-18 13:51 ` Michael Kerrisk (man-pages)
2016-04-25 8:47 ` Christoph Hellwig
2016-04-25 17:35 ` Michael Kerrisk (man-pages)
2016-05-08 9:29 ` Christoph Hellwig
2016-03-03 15:04 ` [PATCH 3/6] x86: wire up preadv2 and pwritev2 Christoph Hellwig
2016-03-03 15:04 ` Christoph Hellwig [this message]
2016-05-08 21:47 ` [PATCH 4/6] vfs: add the RWF_HIPRI flag for preadv2/pwritev2 NeilBrown
2016-05-11 8:55 ` Christoph Hellwig
2016-03-03 15:04 ` [PATCH 5/6] direct-io: only use block polling if explicitly requested Christoph Hellwig
2016-03-03 15:04 ` [PATCH 6/6] blk-mq: enable polling support by default Christoph Hellwig
2016-03-03 15:09 ` generic RDMA READ/WRITE API V2 Sagi Grimberg
2016-03-03 15:11 ` selective block polling and preadv2/pwritev2 revisited V3 Christoph Hellwig
2016-03-03 15:16 ` Jens Axboe
2016-03-03 15:52 ` Arnd Bergmann
2016-03-03 16:11 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2015-12-24 14:14 selective block polling and preadv2/pwritev2 revisited Christoph Hellwig
2015-12-24 14:14 ` [PATCH 4/6] vfs: add the RWF_HIPRI flag for preadv2/pwritev2 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=1457017443-17662-5-git-send-email-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@fb.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=milosz@adfin.com \
--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;
as well as URLs for NNTP newsgroup(s).