* [Cluster-devel] [PATCH 1/3] gfs2: fallocate_chunk: Always initialize struct iomap
2018-07-07 9:39 [Cluster-devel] [PATCH 0/3] gfs2: More iomap enablement Andreas Gruenbacher
@ 2018-07-07 9:39 ` Andreas Gruenbacher
2018-07-07 9:39 ` [Cluster-devel] [PATCH 2/3] gfs2: Use iomap for stuffed direct I/O reads Andreas Gruenbacher
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Andreas Gruenbacher @ 2018-07-07 9:39 UTC (permalink / raw)
To: cluster-devel.redhat.com
In fallocate_chunk, always initialize the iomap before calling
gfs2_iomap_get_alloc: future changes could otherwise cause things like
iomap.flags to leak across calls.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index f3c6d78659b1..6d895d39158a 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -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)
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Cluster-devel] [PATCH 2/3] gfs2: Use iomap for stuffed direct I/O reads
2018-07-07 9:39 [Cluster-devel] [PATCH 0/3] gfs2: More iomap enablement Andreas Gruenbacher
2018-07-07 9:39 ` [Cluster-devel] [PATCH 1/3] gfs2: fallocate_chunk: Always initialize struct iomap Andreas Gruenbacher
@ 2018-07-07 9:39 ` Andreas Gruenbacher
2018-07-07 9:39 ` [Cluster-devel] [PATCH 3/3] gfs2: use iomap_readpage for blocksize == PAGE_SIZE Andreas Gruenbacher
2018-07-09 12:47 ` [Cluster-devel] [PATCH 0/3] gfs2: More iomap enablement Bob Peterson
3 siblings, 0 replies; 5+ messages in thread
From: Andreas Gruenbacher @ 2018-07-07 9:39 UTC (permalink / raw)
To: cluster-devel.redhat.com
Remove 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.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/file.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 6d895d39158a..08369c6cd127 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -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);
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Cluster-devel] [PATCH 3/3] gfs2: use iomap_readpage for blocksize == PAGE_SIZE
2018-07-07 9:39 [Cluster-devel] [PATCH 0/3] gfs2: More iomap enablement Andreas Gruenbacher
2018-07-07 9:39 ` [Cluster-devel] [PATCH 1/3] gfs2: fallocate_chunk: Always initialize struct iomap Andreas Gruenbacher
2018-07-07 9:39 ` [Cluster-devel] [PATCH 2/3] gfs2: Use iomap for stuffed direct I/O reads Andreas Gruenbacher
@ 2018-07-07 9:39 ` Andreas Gruenbacher
2018-07-09 12:47 ` [Cluster-devel] [PATCH 0/3] gfs2: More iomap enablement Bob Peterson
3 siblings, 0 replies; 5+ messages in thread
From: Andreas Gruenbacher @ 2018-07-07 9:39 UTC (permalink / raw)
To: cluster-devel.redhat.com
We 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.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/aops.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index cc80fd71f3dd..31e8270d0b26 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -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 {
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Cluster-devel] [PATCH 0/3] gfs2: More iomap enablement
2018-07-07 9:39 [Cluster-devel] [PATCH 0/3] gfs2: More iomap enablement Andreas Gruenbacher
` (2 preceding siblings ...)
2018-07-07 9:39 ` [Cluster-devel] [PATCH 3/3] gfs2: use iomap_readpage for blocksize == PAGE_SIZE Andreas Gruenbacher
@ 2018-07-09 12:47 ` Bob Peterson
3 siblings, 0 replies; 5+ messages in thread
From: Bob Peterson @ 2018-07-09 12:47 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi Andreas,
----- Original Message -----
> 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
These three look good to me. Feel free to add my Reviewed-by.
Bob Peterson
^ permalink raw reply [flat|nested] 5+ messages in thread