[PATCH 2/3] btrfs: pass in DIO_SKIP_DIO_COUNT to do_blockdev_direct_IO()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



btrfs_direct_IO() already holds the inode i_dio_count elevated, so
pass in that do_blockdev_direct_IO() does not need to. If we end
up dropping the inode dio count before calling this function, then
we drop the flag as well.

Cc: Chris Mason <clm@xxxxxx>
Signed-off-by: Jens Axboe <axboe@xxxxxx>
---
 fs/btrfs/inode.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6fe341a66ed8..3ecac37f10e0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8121,8 +8121,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
 	struct inode *inode = file->f_mapping->host;
 	u64 outstanding_extents = 0;
 	size_t count = 0;
-	int flags = 0;
-	bool wakeup = true;
+	int flags = DIO_SKIP_DIO_COUNT;
 	bool relock = false;
 	ssize_t ret;
 
@@ -8170,8 +8169,11 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
 	} else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK,
 				     &BTRFS_I(inode)->runtime_flags)) {
 		inode_dio_dec(inode);
+		/*
+		 * we know need i_dio_count inc/dec, the below overwrites
+		 * the skip inc/dec flag.
+		 */
 		flags = DIO_LOCKING | DIO_SKIP_HOLES;
-		wakeup = false;
 	}
 
 	ret = __blockdev_direct_IO(rw, iocb, inode,
@@ -8187,7 +8189,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
 						     count - (size_t)ret);
 	}
 out:
-	if (wakeup)
+	if (flags & DIO_SKIP_DIO_COUNT)
 		inode_dio_dec(inode);
 	if (relock)
 		mutex_lock(&inode->i_mutex);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux