Re: [PATCH] filemap: Fix some misleading comments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 25 Nov 2022 15:09:59 +0800 Jiachen Zhang <zhangjiachen.jaycee@xxxxxxxxxxxxx> 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.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux