[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240515055719.32577-2-da.gomez@samsung.com>
Date: Wed, 15 May 2024 05:57:23 +0000
From: Daniel Gomez <da.gomez@...sung.com>
To: "hughd@...gle.com" <hughd@...gle.com>, "akpm@...ux-foundation.org"
<akpm@...ux-foundation.org>, "willy@...radead.org" <willy@...radead.org>,
"jack@...e.cz" <jack@...e.cz>, "mcgrof@...nel.org" <mcgrof@...nel.org>
CC: "linux-mm@...ck.org" <linux-mm@...ck.org>, "linux-xfs@...r.kernel.org"
<linux-xfs@...r.kernel.org>, "djwong@...nel.org" <djwong@...nel.org>,
"Pankaj Raghav" <p.raghav@...sung.com>, "dagmcr@...il.com"
<dagmcr@...il.com>, "yosryahmed@...gle.com" <yosryahmed@...gle.com>,
"baolin.wang@...ux.alibaba.com" <baolin.wang@...ux.alibaba.com>,
"ritesh.list@...il.com" <ritesh.list@...il.com>,
"lsf-pc@...ts.linux-foundation.org" <lsf-pc@...ts.linux-foundation.org>,
"david@...hat.com" <david@...hat.com>, "chandan.babu@...cle.com"
<chandan.babu@...cle.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "brauner@...nel.org" <brauner@...nel.org>,
Daniel Gomez <da.gomez@...sung.com>
Subject: [PATCH 01/12] splice: don't check for uptodate if partially
uptodate is impl
From: Pankaj Raghav <p.raghav@...sung.com>
When a large folio is alloced, splice will zero out the whole folio even
if only a small part of it is written, and it updates the uptodate flag
of the folio.
Once the per-block uptodate tracking is implemented for tmpfs,
pipe_buf_confirm() only needs to check the range it needs to splice to
be uptodate and not the whole folio as we don't set uptodate flag for
partial writes.
Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
Signed-off-by: Daniel Gomez <da.gomez@...sung.com>
---
fs/splice.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/fs/splice.c b/fs/splice.c
index 218e24b1ac40..e6ac57795590 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -120,7 +120,9 @@ static int page_cache_pipe_buf_confirm(struct pipe_inode_info *pipe,
struct pipe_buffer *buf)
{
struct folio *folio = page_folio(buf->page);
+ const struct address_space_operations *ops;
int err;
+ off_t off = folio_page_idx(folio, buf->page) * PAGE_SIZE + buf->offset;
if (!folio_test_uptodate(folio)) {
folio_lock(folio);
@@ -134,12 +136,21 @@ static int page_cache_pipe_buf_confirm(struct pipe_inode_info *pipe,
goto error;
}
+ ops = folio->mapping->a_ops;
/*
* Uh oh, read-error from disk.
*/
- if (!folio_test_uptodate(folio)) {
- err = -EIO;
- goto error;
+ if (!ops->is_partially_uptodate) {
+ if (!folio_test_uptodate(folio)) {
+ err = -EIO;
+ goto error;
+ }
+ } else {
+ if (!ops->is_partially_uptodate(folio, off,
+ buf->len)) {
+ err = -EIO;
+ goto error;
+ }
}
/* Folio is ok after all, we are done */
--
2.43.0
Powered by blists - more mailing lists