linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, xieyongji@bytedance.com
Subject: Re: [PATCH] filemap: Fix some misleading comments
Date: Fri, 25 Nov 2022 16:52:42 -0800	[thread overview]
Message-ID: <20221125165242.a33918e30cc9dc70750ed95f@linux-foundation.org> (raw)
In-Reply-To: <20221125070959.49027-1-zhangjiachen.jaycee@bytedance.com>

On Fri, 25 Nov 2022 15:09:59 +0800 Jiachen Zhang <zhangjiachen.jaycee@bytedance.com> wrote:

> The users of filemap_write_and_wait_range() and file_write_and_wait_range()
> interfaces should set the lend parameter to LLONG_MAX, rather than -1, to
> indicate they want to writeback to the very end-of-file, as several kernel
> code paths are checking the 'wbc->range_end == LLONG_MAX' conditions.

Unclear.  LLONG_MAX differs from -1 on 64-bit and differs differently
on 32-bit.

> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -661,7 +661,8 @@ EXPORT_SYMBOL_GPL(filemap_range_has_writeback);
>   * Write out and wait upon file offsets lstart->lend, inclusive.
>   *
>   * Note that @lend is inclusive (describes the last byte to be written) so
> - * that this function can be used to write to the very end-of-file (end = -1).
> + * that this function can be used to write to the very end-of-file (@lend =
> + * LLONG_MAX).
>   *

The write(2) manpage says "According to POSIX.1, if count is greater
than SSIZE_MAX, the result is implementation-defined; see NOTES for the
upper limit on Linux." And filemap_fdatawrite_wbc() enforces LONG_MAX,
which differs from LLONG_MAX on 32-bit.

I suspect more research is needed here.


  reply	other threads:[~2022-11-26  0:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25  7:09 Jiachen Zhang
2022-11-26  0:52 ` Andrew Morton [this message]
2022-11-26  3:28   ` [External] " Jiachen Zhang

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=20221125165242.a33918e30cc9dc70750ed95f@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    --cc=xieyongji@bytedance.com \
    --cc=zhangjiachen.jaycee@bytedance.com \
    /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