From: Brian Foster <bfoster@redhat.com>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christoph Hellwig <hch@infradead.org>
Subject: [PATCH v2 2/2] mm/fadvise: use LLONG_MAX instead of -1 for eof
Date: Mon, 28 Nov 2022 10:56:32 -0500 [thread overview]
Message-ID: <20221128155632.3950447-3-bfoster@redhat.com> (raw)
In-Reply-To: <20221128155632.3950447-1-bfoster@redhat.com>
generic_fadvise() sets endbyte = -1 to specify end of file (i.e. if
length == 0 is passed from userspace). Most other callers to
filemap_fdatawrite_range() use LLONG_MAX for this purpose,
particularly if they also call fdatawait_range() (which requires end
>= start). For example, sync_file_range(), vfs_fsync() (where the
range is passed down through per-fs ->fsync() callbacks),
filemap_flush(), etc. generic_fadvise() does not currently wait on
writeback, but fix the call up to be consistent with other callers.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
mm/fadvise.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/fadvise.c b/mm/fadvise.c
index c76ee665355a..bf04fec87f35 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -72,7 +72,7 @@ int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
*/
endbyte = (u64)offset + (u64)len;
if (!len || endbyte < len)
- endbyte = -1;
+ endbyte = LLONG_MAX;
else
endbyte--; /* inclusive */
--
2.37.3
next prev parent reply other threads:[~2022-11-28 15:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 15:56 [PATCH v2 0/2] filemap: skip write and wait if end offset precedes start Brian Foster
2022-11-28 15:56 ` [PATCH v2 1/2] " Brian Foster
2022-11-30 7:44 ` Christoph Hellwig
2022-11-28 15:56 ` Brian Foster [this message]
2022-11-30 7:46 ` [PATCH v2 2/2] mm/fadvise: use LLONG_MAX instead of -1 for eof Christoph Hellwig
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=20221128155632.3950447-3-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=linux-mm@kvack.org \
/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