Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp337413pxb; Tue, 9 Feb 2021 01:26:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzITCNxIUiNyzYXdBGgFdotMCpG5IdXNMQvEL8eeaUsWrlUBSpslur2P/sv5NUZrrSvF+wU X-Received: by 2002:a17:906:a153:: with SMTP id bu19mr21914300ejb.287.1612862790224; Tue, 09 Feb 2021 01:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612862790; cv=none; d=google.com; s=arc-20160816; b=dtaPh+4FrUjh5aOi9t/fj5QxCZ6lgGVc2q9nTCvBfcEdyOrnrtvDxVDuzZDDkkmE7m PagPOCjMWXkW7kMJ53VJKy1RIlCfhbK28X+nM7wdQkVTrzl8wlElu07vZJDhHjfDOTn8 LzUCKJqZvdsrYNHVv7w3Yo7yypcIpNTfKragucF4RHmRqUPGgJcm+8/c+RVZOqfhVpxi hP9RRwy88WlN5/yl9XPhvnKf4nmqwIGrXrpCoQJsp84hYHZA0iikdqBq4c8I1hmifhb2 W6soqKN4Nz4oQRgNt7iDrIVCR2OK5S91suPM7fnfNJmw0FoqcSsaFSXvZndkYY0ICeMp EW3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=m6F190rWkzD+sj6gGPF1npucp+eCk2Js2CDBCksYjwE=; b=GPgl+9pGP0sCsYlFu1N+599fZb1UuiHpcqpZ3AW4ktrXift5x9IAgdsJnY8o/BF8eo ZjlmDweCQmioNW3PEsior8KJL65hy4GzW8GgXDaNwupcXgUtngkSmIYvENkV/BdfhINA eJ/TVjUnG9xYkUtUPC9GRTarHsM9j06MzgSs08GFSyBHo1h4i0rjd09qzQuA7hwwETqw ppr11rFwASp7sKfg1g+rSWWF+bjGvqdLKKqFgOEiQvx/X5aJqw+3ILDcU2Rw3lhDU6Zw 1ONz/6YUphUs0kflQel3qWBC3WxdatL25TWwiyPgoZttiuGdpcdAuqldAlk6AFFhjhga odnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q21si13479920edt.445.2021.02.09.01.26.06; Tue, 09 Feb 2021 01:26:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230132AbhBIJWl (ORCPT + 99 others); Tue, 9 Feb 2021 04:22:41 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:8547 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229894AbhBIJTA (ORCPT ); Tue, 9 Feb 2021 04:19:00 -0500 X-IronPort-AV: E=Sophos;i="5.81,164,1610380800"; d="scan'208";a="104367244" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Feb 2021 17:15:20 +0800 Received: from G08CNEXMBPEKD05.g08.fujitsu.local (unknown [10.167.33.204]) by cn.fujitsu.com (Postfix) with ESMTP id A2C304CE6F86; Tue, 9 Feb 2021 17:15:13 +0800 (CST) Received: from irides.mr (10.167.225.141) by G08CNEXMBPEKD05.g08.fujitsu.local (10.167.33.204) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 9 Feb 2021 17:15:12 +0800 Subject: Re: [PATCH 5/7] fsdax: Dedup file range to use a compare function To: Christoph Hellwig CC: , , , , , , , , , , , , , Goldwyn Rodrigues References: <20210207170924.2933035-1-ruansy.fnst@cn.fujitsu.com> <20210207170924.2933035-6-ruansy.fnst@cn.fujitsu.com> <20210208151920.GE12872@lst.de> From: Ruan Shiyang Message-ID: <9193e305-22a1-3928-0675-af1cecd28942@cn.fujitsu.com> Date: Tue, 9 Feb 2021 17:15:13 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210208151920.GE12872@lst.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.167.225.141] X-ClientProxiedBy: G08CNEXCHPEKD04.g08.fujitsu.local (10.167.33.200) To G08CNEXMBPEKD05.g08.fujitsu.local (10.167.33.204) X-yoursite-MailScanner-ID: A2C304CE6F86.ACFE6 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@cn.fujitsu.com X-Spam-Status: No Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/2/8 下午11:19, Christoph Hellwig wrote: > On Mon, Feb 08, 2021 at 01:09:22AM +0800, Shiyang Ruan wrote: >> With dax we cannot deal with readpage() etc. So, we create a >> funciton callback to perform the file data comparison and pass > > s/funciton/function/g > >> +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) > > This should use the existing min or min_t helpers. > > >> int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, >> struct file *file_out, loff_t pos_out, >> - loff_t *len, unsigned int remap_flags) >> + loff_t *len, unsigned int remap_flags, >> + compare_range_t compare_range_fn) > > Can we keep generic_remap_file_range_prep as-is, and add a new > dax_remap_file_range_prep, both sharing a low-level > __generic_remap_file_range_prep implementation? And for that > implementation I'd also go for classic if/else instead of the function > pointer. The dax dedupe comparison need the iomap_ops pointer as argument, so my understanding is that we don't modify the argument list of generic_remap_file_range_prep(), but move its code into __generic_remap_file_range_prep() whose argument list can be modified to accepts the iomap_ops pointer. Then it looks like this: ``` int dax_remap_file_range_prep(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, loff_t *len, unsigned int remap_flags, const struct iomap_ops *ops) { return __generic_remap_file_range_prep(file_in, pos_in, file_out, pos_out, len, remap_flags, ops); } EXPORT_SYMBOL(dax_remap_file_range_prep); int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, loff_t *len, unsigned int remap_flags) { return __generic_remap_file_range_prep(file_in, pos_in, file_out, pos_out, len, remap_flags, NULL); } EXPORT_SYMBOL(generic_remap_file_range_prep); ``` Am i right? -- Thanks, Ruan Shiyang. > >> +extern int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff, >> + struct inode *dest, loff_t destoff, >> + loff_t len, bool *is_same); > > no need for the extern. > >