ext4: Two trivial improvements for dio path
Jan Kara
reviewercover ext4: Two trivial improvements for dio path
Hi Ted!
I have these two trivial improvements locally that are part of larger DAX changes. Those large changes won't make it for the merge window but this is easy enough... Can you please merge them? Thanks!
Honza
Jan Kara
reviewerPATCH 1/2 ext4: Allow unlocked direct IO when pages are cached
Currently we do not allow unlocked (meaning without inode_lock) direct IO when the file has any pages cached. This check is not needed anymore as we keep inode lock until ext4_direct_IO_write() and thus can happily writeback and evict any pages conflicting with current direct IO write.
--- fs/ext4/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/file.c +1 -2
@@ -91,7 +91,6 @@ ext4_unaligned_aio(struct inode *inode, struct iov_iter *from, loff_t pos)static ssize_t ext4_file_write_iter (struct kiocb *iocb,struct iov_iter *from) { -struct file *file = iocb->ki_filp;struct inode *inode =file_inode (iocb->ki_filp);struct blk_plug plug;int o_direct = iocb->ki_flags &IOCB_DIRECT ;
@@ -138,7 +137,7 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)/* check whether we do a DIO overwrite or not */ if (ext4_should_dioread_nolock (inode) && !unaligned_aio && - !file->f_mapping->nrpages && pos + length <=i_size_read (inode)) { + pos + length <=i_size_read (inode)) {struct ext4_map_blocks map;unsigned int blkbits = inode->i_blkbits;int err, len;
Signature · 1 line
2.6.6
Re: [PATCH 1/2] ext4: Allow unlocked direct IO when pages are cached
Quoted 6 lines · Jan Kara
Currently we do not allow unlocked (meaning without
inode_lock) direct IO when the file has any pages cached. This check is not needed anymore as we keep inode lock untilext4_direct_IO_write()and thus can happily writeback and evict any pages conflicting with current direct IO write.Signed-off-by Jan Kara <[email protected]>
Thanks, applied.
- Ted
Jan Kara
reviewerPATCH 2/2 ext4: Remove plugging from ext4_file_write_iter()
In reply to Jan Karado_blockdev_direct_IO() takes care of properly plugging direct IO so there's no need to plug again inside ext4_file_write_iter().
--- fs/ext4/file.c | 4 ---- 1 file changed, 4 deletions(-)
fs/ext4/file.c +0 -4
@@ -92,7 +92,6 @@ static ssize_t ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) { struct inode *inode = file_inode(iocb->ki_filp); -struct blk_plug plug;int o_direct = iocb->ki_flags &IOCB_DIRECT ;int unaligned_aio =0 ;int overwrite =0 ;
@@ -133,7 +132,6 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)if (o_direct) {size_t length =iov_iter_count (from);loff_t pos = iocb->ki_pos; -blk_start_plug (&plug);/* check whether we do a DIO overwrite or not */ if (ext4_should_dioread_nolock(inode) && !unaligned_aio &&
@@ -170,8 +168,6 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)if (ret >0 ) ret =generic_write_sync (iocb, ret); -if (o_direct) -blk_finish_plug (&plug);return ret;
Signature · 1 line
2.6.6
Re: [PATCH 2/2] ext4: Remove plugging from ext4_file_write_iter()
Quoted 4 lines · Jan Kara
do_blockdev_direct_IO()takes care of properly plugging direct IO so there's no need to plug again insideext4_file_write_iter().Signed-off-by Jan Kara <[email protected]>
Thanks, applied.
- Ted