From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: axboe@kernel.dk, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Cc: brauner@kernel.org, linux-kernel@vger.kernel.org,
viro@zeniv.linux.org.uk
Subject: [PATCH 1/2] mm/filemap: fix miscalculated file range for filemap_fdatawrite_range_kick()
Date: Tue, 18 Feb 2025 20:02:08 +0800 [thread overview]
Message-ID: <20250218120209.88093-2-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20250218120209.88093-1-jefflexu@linux.alibaba.com>
iocb->ki_pos has been updated with the number of written bytes since
generic_perform_write().
Besides __filemap_fdatawrite_range() accepts the inclusive end of the
data range.
Fixes: 1d4457576570 ("mm: call filemap_fdatawrite_range_kick() after IOCB_DONTCACHE issue")
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
---
include/linux/fs.h | 4 ++--
mm/filemap.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2c3b2f8a621f..f12774291423 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2975,8 +2975,8 @@ static inline ssize_t generic_write_sync(struct kiocb *iocb, ssize_t count)
} else if (iocb->ki_flags & IOCB_DONTCACHE) {
struct address_space *mapping = iocb->ki_filp->f_mapping;
- filemap_fdatawrite_range_kick(mapping, iocb->ki_pos,
- iocb->ki_pos + count);
+ filemap_fdatawrite_range_kick(mapping, iocb->ki_pos - count,
+ iocb->ki_pos - 1);
}
return count;
diff --git a/mm/filemap.c b/mm/filemap.c
index 804d7365680c..d4564a79eb35 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -445,7 +445,7 @@ EXPORT_SYMBOL(filemap_fdatawrite_range);
* filemap_fdatawrite_range_kick - start writeback on a range
* @mapping: target address_space
* @start: index to start writeback on
- * @end: last (non-inclusive) index for writeback
+ * @end: last (inclusive) index for writeback
*
* This is a non-integrity writeback helper, to start writing back folios
* for the indicated range.
--
2.19.1.6.gb485710b
next prev parent reply other threads:[~2025-02-18 12:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 12:02 [PATCH 0/2] fixes for uncached IO Jingbo Xu
2025-02-18 12:02 ` Jingbo Xu [this message]
2025-02-19 16:25 ` [PATCH 1/2] mm/filemap: fix miscalculated file range for filemap_fdatawrite_range_kick() Jens Axboe
2025-02-18 12:02 ` [PATCH 2/2] mm/truncate: don't skip dirty page in folio_unmap_invalidate() Jingbo Xu
2025-02-18 12:32 ` Kirill A. Shutemov
2025-02-19 1:23 ` Jingbo Xu
2025-02-19 16:23 ` Jens Axboe
2025-02-19 0:11 ` Dave Chinner
2025-02-19 1:55 ` Jingbo Xu
2025-02-21 11:09 ` [PATCH 0/2] fixes for uncached IO Jingbo Xu
2025-02-21 13:10 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250218120209.88093-2-jefflexu@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox