All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Miklos Szeredi <mszeredi@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Amir Goldstein <amir73il@gmail.com>
Subject: Re: [PATCH 1/3] vfs: dedpue: return s64
Date: Mon, 7 May 2018 05:17:58 -0700	[thread overview]
Message-ID: <20180507121758.GD18116@bombadil.infradead.org> (raw)
In-Reply-To: <CAOssrKebppZhRbvM-3qk=S0aY57skYCEn2axknOtF9LcJcu8yA@mail.gmail.com>

On Mon, May 07, 2018 at 01:32:09PM +0200, Miklos Szeredi wrote:
> On Mon, May 7, 2018 at 1:11 PM, Matthew Wilcox <willy@infradead.org> wrote:
> > On Mon, May 07, 2018 at 10:21:06AM +0200, Miklos Szeredi wrote:
> >> f_op->dedupe_file_range() gets a u64 length to dedup and returns an ssize_t
> >> actual length deduped.  This breaks badly on 32bit archs since the returned
> >> length will be truncated and possibly overflow into the sign bit (xfs and
> >> ocfs2 are affected, btrfs limits actual length to 16MiB).
> >>
> >> Returning s64 should be good, since clone_verify_area() makes sure that the
> >> supplied length doesn't overflow.
> >
> > Why s64 rather than loff_t?  Particularly since the next patch turns
> > the paramters into loff_t.
> 
> Next patch turns the offsets into loff_t and leaves "len" as u64.  A
> size is definitely not an offset, I'd consider changing the type of
> "len" to loff_t a misuse.

Usually a size is the size of something in memory.  The length of
something on storage is definitely an loff_t.  Look at fallocate()
for an example.  You could also argue that lseek where whence is set to
anything other than SEEK_SET is also being used as a length rather than
an absolute offset.  We also already use 'loff_t len' as an argument to
vfs_dedupe_file_range_compare().

  reply	other threads:[~2018-05-07 12:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-07  8:21 [PATCH 0/3] vfs: dedupe: cleanup API and implementation Miklos Szeredi
2018-05-07  8:21 ` [PATCH 1/3] vfs: dedpue: return s64 Miklos Szeredi
2018-05-07 11:11   ` Matthew Wilcox
2018-05-07 11:32     ` Miklos Szeredi
2018-05-07 12:17       ` Matthew Wilcox [this message]
2018-05-07 14:26         ` Miklos Szeredi
2018-05-07  8:21 ` [PATCH 2/3] vfs: dedupe: rationalize args Miklos Szeredi
2018-05-07 11:16   ` Matthew Wilcox
2018-05-07 11:36     ` Miklos Szeredi
2018-05-07  8:21 ` [PATCH 3/3] vfs: dedupe: extract helper for a single dedup Miklos Szeredi

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=20180507121758.GD18116@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.