Received: by 10.192.165.148 with SMTP id m20csp3147183imm; Mon, 7 May 2018 07:26:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZruxPw9M7DQvNc9zn78Xo4D0LLn/7DhlFtA1belpH3AZco0YVmTs1U5tfopXtaTIHdBMxQI X-Received: by 2002:aca:170a:: with SMTP id j10-v6mr21309763oii.277.1525703199204; Mon, 07 May 2018 07:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525703199; cv=none; d=google.com; s=arc-20160816; b=J3RgqFwz/bufoCP/62QXo6SDB0xmrKragyWIrSvV+s5aJf2QHwCTqu2RBjkwE6WdoL Aq3Ac1qs17Y4H4aHBClKPlm8bQbKtWQUb3Wm7pqTNvVKTxpK/hwvGHCt50rAyQ9P6tnV qQJShmvysk+LHXQwGH/vqvocvk4gXIOcVL+AezLVMLePNV99qBqAJ6fOiIuzYYFtgz7W MfArzYmyK3Fd02s1DjfxYLjIYGvVl6gomihM17u8gmIMOZcmbMxshgGpgrJrMthw/sHk X3FZqx6XwXhRij8CpqVzoFFjg+4A5leA58gGquZLjLCRGT0XhPCUnJfUZa9eZp7Bi4zA TR5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=h9N9V5tDi4QRZCEvuSXbSbtVMbvfLzmxwIFRiW8iLm0=; b=uIpPUQbaXwwZT1ZIPbUAUZ1FDi8qoN5QX0vkfdHYoRRtR5Xjh02Yggw2oEn0MdXPgf IYSf8bpWWVz2U/LXMouESILJE5XaNMtMx8J4+xzDiX8YKA1wweLkQov1ArA4baFaiKfO pjirb1maJ6CxYYGgUt1JioBl62g4WX8srIN3XQTxEgGA6u26JnaWSn5iqOYHZTXeEr5T 9F6f+u/EPRv6IOJMJScUIagD6UgMST80DQeEBK2fyAuTk/fQKV5SXkpbIcHVVkwpuaNy UKmil97xuPwjR5pgA3/h+g7h/ANMFE7r9Mdu6epvf5EtCPhpXUVEZWLgJ3w/jvaxZ9L4 f9bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6-v6si8074523oth.37.2018.05.07.07.26.25; Mon, 07 May 2018 07:26:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752674AbeEGO0L (ORCPT + 99 others); Mon, 7 May 2018 10:26:11 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:34347 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbeEGO0G (ORCPT ); Mon, 7 May 2018 10:26:06 -0400 Received: by mail-ot0-f196.google.com with SMTP id i5-v6so20500208otf.1 for ; Mon, 07 May 2018 07:26:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=h9N9V5tDi4QRZCEvuSXbSbtVMbvfLzmxwIFRiW8iLm0=; b=hMRowzJWFcMK+lvDY1ZQS/a3fo8T4Ofwm4TRWIzTjz3brXOs+In12L83Ukc97/xzKo 59mQAn1iM5pqON9lplvSuJieY3MtvWrilQltrbF0qFP/Mi6Zdhxn3U42l100R2ubk0X4 EhixB7Fq/i9DtZ/kxNLBecd6F7oYEGPLQdTUO+Zn39MaYdZlxbPzr0y6A1iafrlbk4hP QSwyxzldsC4L0VdEZBRdPKCTfjtNB9UeEie522C7hNNTVqBdrujUE83yjbbNuSsRPcOE ibLd12tdGkPfYlsx6zEqOkJzbWUPFFapv0TE5EI0Cy+m04uBj5WzQnFKTIX+eh8nhzG6 tyZg== X-Gm-Message-State: ALQs6tAYAP/IVn/Ow7UVX0Fg6j2nPpwcxr+a422DLL1JzaiJm/NKcFJC xBtNcI8+ZPdWDPaiSl/2ND1Tf7jR+jSmIxJm4kAi1A== X-Received: by 2002:a9d:5b47:: with SMTP id e7-v6mr27553094otj.62.1525703166113; Mon, 07 May 2018 07:26:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:58cd:0:0:0:0:0 with HTTP; Mon, 7 May 2018 07:26:05 -0700 (PDT) In-Reply-To: <20180507121758.GD18116@bombadil.infradead.org> References: <20180507082108.28186-1-mszeredi@redhat.com> <20180507082108.28186-2-mszeredi@redhat.com> <20180507111142.GA18116@bombadil.infradead.org> <20180507121758.GD18116@bombadil.infradead.org> From: Miklos Szeredi Date: Mon, 7 May 2018 16:26:05 +0200 Message-ID: Subject: Re: [PATCH 1/3] vfs: dedpue: return s64 To: Matthew Wilcox Cc: Al Viro , linux-fsdevel , lkml , Amir Goldstein Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 7, 2018 at 2:17 PM, Matthew Wilcox wrote: > On Mon, May 07, 2018 at 01:32:09PM +0200, Miklos Szeredi wrote: >> On Mon, May 7, 2018 at 1:11 PM, Matthew Wilcox 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(). Fair enough. Will fix. Thanks, Miklos