[PATCH 1/1] For DIO writes with no mapped pages for inode, skip deferring completion.

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

 



If there are no mapped pages for an DIO write then the page cache does not
need to be updated. For very fast SSDs and direct async IO, deferring work
completion can result in a significant performance loss.
---
 fs/iomap/direct-io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 019cc87d0fb3..8f27d0dc4f6d 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -168,7 +168,9 @@ void iomap_dio_bio_end_io(struct bio *bio)
 			struct task_struct *waiter = dio->submit.waiter;
 			WRITE_ONCE(dio->submit.waiter, NULL);
 			blk_wake_io_task(waiter);
-		} else if (dio->flags & IOMAP_DIO_WRITE) {
+		} else if (dio->flags & IOMAP_DIO_WRITE &&
+			(!dio->iocb->ki_filp->f_inode ||
+			    dio->iocb->ki_filp->f_inode->i_mapping->nrpages))) {
 			struct inode *inode = file_inode(dio->iocb->ki_filp);
 
 			WRITE_ONCE(dio->iocb->private, NULL);
-- 
2.41.0.185.g7c58973941-goog




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

  Powered by Linux