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=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham 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 49DC5C04AAF for ; Tue, 21 May 2019 13:23:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 278D02173C for ; Tue, 21 May 2019 13:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727941AbfEUNXX (ORCPT ); Tue, 21 May 2019 09:23:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:39168 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726692AbfEUNXX (ORCPT ); Tue, 21 May 2019 09:23:23 -0400 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 EA77EAE8A; Tue, 21 May 2019 13:23:21 +0000 (UTC) Date: Tue, 21 May 2019 15:23:21 +0200 From: Johannes Thumshirn To: Nikolay Borisov Cc: David Sterba , Linux BTRFS Mailinglist , Chris Mason , Richard Weinberger , David Gstir Subject: Re: [PATCH v2 09/13] btrfs: Simplify btrfs_check_super_csum() and get rid of size assumptions Message-ID: <20190521132321.GD7200@x250> References: <20190516084803.9774-1-jthumshirn@suse.de> <20190516084803.9774-10-jthumshirn@suse.de> <1d61314d-246d-ee95-1643-5c4cc2c5e919@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1d61314d-246d-ee95-1643-5c4cc2c5e919@suse.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Tue, May 21, 2019 at 04:01:36PM +0300, Nikolay Borisov wrote: > > > On 16.05.19 г. 11:47 ч., Johannes Thumshirn wrote: > > Now that we have already checked for a valid checksum type before calling > > btrfs_check_super_csum(), it can be simplified even further. > > > > While at it get rid of the implicit size assumption of the resulting > > checksum as well. > > > > Signed-off-by: Johannes Thumshirn > > Reviewed-by: Nikolay Borisov > > > > --- > > Changes to v1: > > - Check for disk_sb->csum instead of raw buffer (Nikolay) > > --- > > fs/btrfs/disk-io.c | 37 +++++++++++++------------------------ > > 1 file changed, 13 insertions(+), 24 deletions(-) > > > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > > index 74937effaed4..edb8bc79b01b 100644 > > --- a/fs/btrfs/disk-io.c > > +++ b/fs/btrfs/disk-io.c > > @@ -375,33 +375,22 @@ static int btrfs_check_super_csum(struct btrfs_fs_info *fs_info, > > { > > This function no longer requires the btrfs_fs_info argument so it should > be removed. While on the topic of refactoring this function - why not > change it's return type to bool since it can't return anything other > than 0/1 ? Patch 11/13 will need fs_info again. -- Johannes Thumshirn SUSE Labs Filesystems jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850