archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <>
	Al Viro <>
Cc: David Sterba <>,, "Theodore Ts'o" <>,
	Andreas Dilger <>
Subject: [RFC PATCH v2 2/6] ext4: use iocb->private instead of bh->b_private
Date: Mon, 27 Aug 2018 17:03:15 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Omar Sandoval <>

As part of simplifying all of the private data passed around for direct
I/O, bh->b_private will no longer be passed to dio_iodone_t. iocb is
still available there, however, so convert ext4 to use it. Note that
ext4_file_write_iter() also uses iocb->private, but
ext4_direct_IO_write() resets it to NULL after reading it.

Also note that the comment above ext4_should_dioread_nolock() is no
longer accurate. It seems that it should be possible to remove the data
journaling restriction now?

Cc: "Theodore Ts'o" <>
Cc: Andreas Dilger <>
Signed-off-by: Omar Sandoval <>
 fs/ext4/inode.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 18ad91b1c8f6..841d79919cef 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -884,18 +884,16 @@ static int ext4_dio_get_block_unwritten_async(struct kiocb *iocb,
 	 * When doing DIO using unwritten extents, we need io_end to convert
 	 * unwritten extents to written on IO completion. We allocate io_end
-	 * once we spot unwritten extent and store it in b_private. Generic
-	 * DIO code keeps b_private set and furthermore passes the value to
-	 * our completion callback in 'private' argument.
+	 * once we spot unwritten extent and store it in iocb->private.
 	if (!ret && buffer_unwritten(bh_result)) {
-		if (!bh_result->b_private) {
+		if (!iocb->private) {
 			ext4_io_end_t *io_end;
 			io_end = ext4_init_io_end(inode, GFP_KERNEL);
 			if (!io_end)
 				return -ENOMEM;
-			bh_result->b_private = io_end;
+			iocb->private = io_end;
 			ext4_set_io_unwritten_flag(inode, io_end);
@@ -3617,7 +3615,7 @@ const struct iomap_ops ext4_iomap_ops = {
 static int ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
 			    ssize_t size, void *private)
-        ext4_io_end_t *io_end = private;
+        ext4_io_end_t *io_end = iocb->private;
 	/* if not async direct IO just return */
 	if (!io_end)

  parent reply	other threads:[~2018-08-28  3:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28  0:03 [RFC PATCH v2 0/6] Btrfs: stop abusing current->journal_info for direct I/O Omar Sandoval
2018-08-28  0:03 ` [RFC PATCH v2 1/6] fs: pass iocb to direct I/O get_block() Omar Sandoval
2018-08-28  0:03 ` Omar Sandoval [this message]
2018-08-28  0:03 ` [RFC PATCH v2 3/6] ocfs2: use iocb->private instead of bh->b_private Omar Sandoval
2018-08-28  0:03 ` [RFC PATCH v2 4/6] fs: stop propagating bh->b_private for direct I/O Omar Sandoval
2018-08-28  0:03 ` [RFC PATCH v2 5/6] fs: pass iocb to direct I/O submit_io() Omar Sandoval
2018-08-28  0:03 ` [RFC PATCH v2 6/6] Btrfs: stop abusing current->journal_info in btrfs_direct_IO() Omar Sandoval

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \

* 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).