From: Bharata B Rao <bharata@amd.com>
To: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-fsdevel@vger.kernel.org>, <linux-mm@kvack.org>
Cc: <nikunj@amd.com>, <willy@infradead.org>, <vbabka@suse.cz>,
<david@redhat.com>, <akpm@linux-foundation.org>,
<yuzhao@google.com>, <mjguzik@gmail.com>, <axboe@kernel.dk>,
<viro@zeniv.linux.org.uk>, <brauner@kernel.org>, <jack@suse.cz>,
<joshdon@google.com>, <clm@meta.com>,
Bharata B Rao <bharata@amd.com>
Subject: [RFC PATCH 1/1] block/ioctl: Add an ioctl to enable large folios for block buffered IO path
Date: Wed, 27 Nov 2024 11:17:37 +0530 [thread overview]
Message-ID: <20241127054737.33351-2-bharata@amd.com> (raw)
In-Reply-To: <20241127054737.33351-1-bharata@amd.com>
In order to experiment using large folios for block devices read/write
operations, expose an ioctl that userspace can selectively use on the
raw block devices.
For the write path, this forces iomap layer to provision large
folios (via iomap_file_buffered_write()).
Signed-off-by: Bharata B Rao <bharata@amd.com>
---
block/ioctl.c | 8 ++++++++
include/uapi/linux/fs.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/block/ioctl.c b/block/ioctl.c
index 6554b728bae6..6af26a08ef34 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -548,6 +548,12 @@ static int blkdev_bszset(struct file *file, blk_mode_t mode,
return ret;
}
+static int blkdev_set_large_folio(struct block_device *bdev)
+{
+ mapping_set_large_folios(bdev->bd_mapping);
+ return 0;
+}
+
/*
* Common commands that are handled the same way on native and compat
* user space. Note the separate arg/argp parameters that are needed
@@ -632,6 +638,8 @@ static int blkdev_common_ioctl(struct block_device *bdev, blk_mode_t mode,
return blkdev_pr_preempt(bdev, mode, argp, true);
case IOC_PR_CLEAR:
return blkdev_pr_clear(bdev, mode, argp);
+ case BLKSETLFOLIO:
+ return blkdev_set_large_folio(bdev);
default:
return -ENOIOCTLCMD;
}
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 753971770733..5c8a326b68a1 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -203,6 +203,8 @@ struct fsxattr {
#define BLKROTATIONAL _IO(0x12,126)
#define BLKZEROOUT _IO(0x12,127)
#define BLKGETDISKSEQ _IOR(0x12,128,__u64)
+#define BLKSETLFOLIO _IO(0x12, 129)
+
/*
* A jump here: 130-136 are reserved for zoned block devices
* (see uapi/linux/blkzoned.h)
--
2.34.1
next prev parent reply other threads:[~2024-11-27 5:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 5:47 [RFC PATCH 0/1] Large folios in " Bharata B Rao
2024-11-27 5:47 ` Bharata B Rao [this message]
2024-11-27 6:26 ` [RFC PATCH 1/1] block/ioctl: Add an ioctl to enable large folios for " Christoph Hellwig
2024-11-27 10:37 ` Bharata B Rao
2024-11-28 5:43 ` Christoph Hellwig
2024-11-27 6:13 ` [RFC PATCH 0/1] Large folios in " Mateusz Guzik
2024-11-27 6:19 ` Mateusz Guzik
2024-11-27 12:02 ` Jan Kara
2024-11-27 12:13 ` Christian Brauner
2024-11-28 5:40 ` Ritesh Harjani
2024-11-27 12:18 ` Bharata B Rao
2024-11-27 12:28 ` Mateusz Guzik
2024-11-28 4:01 ` Bharata B Rao
2024-11-28 4:22 ` Matthew Wilcox
2024-11-28 4:37 ` Bharata B Rao
2024-11-28 11:23 ` Bharata B Rao
2024-11-28 23:31 ` Mateusz Guzik
2024-11-29 10:32 ` Bharata B Rao
2024-11-28 4:22 ` Mateusz Guzik
2024-11-28 4:31 ` Mateusz Guzik
2024-12-02 9:37 ` Bharata B Rao
2024-12-02 10:08 ` Mateusz Guzik
2024-12-03 5:01 ` Bharata B Rao
2024-11-28 4:43 ` Matthew Wilcox
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=20241127054737.33351-2-bharata@amd.com \
--to=bharata@amd.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=clm@meta.com \
--cc=david@redhat.com \
--cc=jack@suse.cz \
--cc=joshdon@google.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mjguzik@gmail.com \
--cc=nikunj@amd.com \
--cc=vbabka@suse.cz \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--cc=yuzhao@google.com \
/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