From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E671EC43603 for ; Tue, 10 Dec 2019 17:12:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0D4A2073B for ; Tue, 10 Dec 2019 17:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727924AbfLJRMN (ORCPT ); Tue, 10 Dec 2019 12:12:13 -0500 Received: from mx2.suse.de ([195.135.220.15]:43826 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727628AbfLJRMN (ORCPT ); Tue, 10 Dec 2019 12:12:13 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C1A8DAE40; Tue, 10 Dec 2019 17:12:11 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id D657CDA727; Tue, 10 Dec 2019 18:12:11 +0100 (CET) Date: Tue, 10 Dec 2019 18:12:10 +0100 From: David Sterba To: Omar Sandoval Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com, Nikolay Borisov Subject: Re: [PATCH 1/9] btrfs: get rid of trivial __btrfs_lookup_bio_sums() wrappers Message-ID: <20191210171210.GC3929@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Omar Sandoval , linux-btrfs@vger.kernel.org, kernel-team@fb.com, Nikolay Borisov References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Mon, Dec 02, 2019 at 05:34:17PM -0800, Omar Sandoval wrote: > From: Omar Sandoval > > Currently, we have two wrappers for __btrfs_lookup_bio_sums(): > btrfs_lookup_bio_sums_dio(), which is used for direct I/O, and > btrfs_lookup_bio_sums(), which is used everywhere else. The only > difference is that the _dio variant looks up csums starting at the given > offset instead of using the page index, which isn't actually direct > I/O-specific. Let's clean up the signature and return value of > __btrfs_lookup_bio_sums(), rename it to btrfs_lookup_bio_sums(), and get > rid of the trivial helpers. > > ret = btrfs_lookup_bio_sums(inode, comp_bio, > - sums); > + false, 0, sums); > - ret = btrfs_lookup_bio_sums(inode, comp_bio, sums); > + ret = btrfs_lookup_bio_sums(inode, comp_bio, false, 0, sums); > - ret = btrfs_lookup_bio_sums(inode, bio, NULL); > + ret = btrfs_lookup_bio_sums(inode, bio, false, 0, NULL); > - ret = btrfs_lookup_bio_sums_dio(inode, dip->orig_bio, > - file_offset); > + ret = btrfs_lookup_bio_sums(inode, dip->orig_bio, true, > + file_offset, NULL); Can't we also get rid of the at_offset parameter? Encoding that into file_offset itself where at_offset=true would be some special placeholder like (u64)-1 that can never be a valid file offset.