gfs2: More iomap enablement
Andreas Gruenbacher
maintainercover gfs2: More iomap enablement
Hi,
here's another forward-looking fix and two enablement patches. The patches depend on the following branches:
xfs-linux/iomap-4.19-merge
linux-gfs/for-next
The "iomap: add initial support for writes without buffer heads" patch on 'iomap-4.19-merge' introduces the IOMAP_F_BUFFER_HEAD flag which needds to be set for gfs2. I've done that in the merge commit for that branch so that we don't end up with any broken commits.
An 'iomap-misc' branch with all those changes can be found here:
https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git/log/?h=iomap-misc
The 'iomap-4.19-merge' branch can be found in the xfs repository:
https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git/log/?h=iomap-4.19-merge
Thanks,
Andreas
Andreas Gruenbacher (3):
gfs2: fallocate_chunk: Always initialize struct iomap
gfs2: Use iomap for stuffed direct I/O reads
gfs2: use iomap_readpage for blocksize == PAGE_SIZE
Signature · 1 line
2.17.1
Andreas Gruenbacher
maintainerPATCH 1/3 gfs2: fallocate_chunk: Always initialize struct iomap
In fallocate_chunk, always initialize the iomap before callinggfs2_iomap_get_alloc: future changes could otherwise cause things like iomap.flags to leak across calls.
--- fs/gfs2/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/gfs2/file.c +2 -1
@@ -877,7 +877,6 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,struct gfs2_inode *ip =GFS2_I (inode);loff_t end = offset + len;struct buffer_head *dibh; -struct iomap iomap = { };int error; error =gfs2_meta_inode_buffer (ip, &dibh);
@@ -893,6 +892,8 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len, }while (offset < end) { +struct iomap iomap = { }; + error =gfs2_iomap_get_alloc (inode, offset, end - offset, &iomap);if (error)
Signature · 1 line
2.17.1
Andreas Gruenbacher
maintainerPATCH 2/3 gfs2: Use iomap for stuffed direct I/O reads
In reply to Andreas GruenbacherRemove the fallback code from direct to buffered I/O for stuffed reads.
For stuffed writes, we must keep the fallback code: the deferred glock we are holding under direct I/O doesn't allow to write to the inode or change the file size.
--- fs/gfs2/file.c | 6 ------ 1 file changed, 6 deletions(-)
fs/gfs2/file.c +0 -6
@@ -706,14 +706,8 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to)if (ret) goto out_uninit; -/* fall back to buffered I/O for stuffed files */ - ret = -ENOTBLK ; -if (gfs2_is_stuffed (ip)) - goto out; - ret =iomap_dio_rw (iocb, to, &gfs2_iomap_ops,NULL ); -out:gfs2_glock_dq (&gh); out_uninit:gfs2_holder_uninit (&gh);
Signature · 1 line
2.17.1
Andreas Gruenbacher
maintainerPATCH 3/3 gfs2: use iomap_readpage for blocksize == PAGE_SIZE
In reply to Andreas GruenbacherWe only use iomap_readpage for pages that don't have buffer heads attached yet: iomap_readpage would otherwise read pages from disk that are marked buffer_uptodate() but not PageUptodate(). Those pages may actually contain data more recent than what's on disk.
--- fs/gfs2/aops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/gfs2/aops.c +5 -1
@@ -508,9 +508,13 @@ static int __gfs2_readpage(void *file, struct page *page) {struct gfs2_inode *ip =GFS2_I (page->mapping->host);struct gfs2_sbd *sdp =GFS2_SB (page->mapping->host); +int error; -if (gfs2_is_stuffed (ip)) { +if (i_blocksize (page->mapping->host) ==PAGE_SIZE && + !page_has_buffers (page)) { + error =iomap_readpage (page, &gfs2_iomap_ops); + }else if (gfs2_is_stuffed (ip)) { error =stuffed_readpage (ip, page);unlock_page (page); }else {
Signature · 1 line
2.17.1
cover gfs2: More iomap enablement
In reply to Andreas GruenbacherHi Andreas,
----- Original Message -----
Quoted 4 lines
Andreas Gruenbacher (3):
gfs2:fallocate_chunk: Always initialize struct iomap
gfs2: Use iomap for stuffed direct I/O reads
gfs2: useiomap_readpagefor blocksize ==PAGE_SIZE
These three look good to me. Feel free to add my Reviewed-by.
Bob Peterson