From patchwork Wed Dec 16 17:55:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sage Weil X-Patchwork-Id: 68406 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBI4ixpc005715 for ; Fri, 18 Dec 2009 04:46:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271AbZLPRzr (ORCPT ); Wed, 16 Dec 2009 12:55:47 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753218AbZLPRzq (ORCPT ); Wed, 16 Dec 2009 12:55:46 -0500 Received: from cobra.newdream.net ([66.33.216.30]:60753 "EHLO cobra.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753070AbZLPRzo (ORCPT ); Wed, 16 Dec 2009 12:55:44 -0500 Received: by cobra.newdream.net (Postfix, from userid 1031) id 15B2ABCB8A; Wed, 16 Dec 2009 09:55:43 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by cobra.newdream.net (Postfix) with ESMTP id F25B4BC7A1; Wed, 16 Dec 2009 09:55:43 -0800 (PST) Date: Wed, 16 Dec 2009 09:55:43 -0800 (PST) From: Sage Weil To: Li Dongyang cc: linux-btrfs@vger.kernel.org Subject: Re: cp --reflink with Btrfs In-Reply-To: <4b287dd5.5744f10a.3536.2011@mx.google.com> Message-ID: References: <20091214162323.GA2165@localhost.localdomain> <4b287dd5.5744f10a.3536.2011@mx.google.com> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index cdbb054..1a964a4 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -994,8 +994,11 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, } /* determine range to clone */ + ret = 0; + if (off == src->i_size && len == 0) + goto out_unlock; ret = -EINVAL; - if (off >= src->i_size || off + len > src->i_size) + if (off > src->i_size || off + len > src->i_size) goto out_unlock; if (len == 0) olen = len = src->i_size - off;