Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1908372lqe; Tue, 9 Apr 2024 04:23:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXS4OxGgiA2gzoOMW+unkSI6ATXvsNk5rm4eEn4nlnKfso7Xc/snKZYSaID5V3ZEBiyb3tZpyU4RfbGjAPzFO9Cged8U8XyzdWiB3m5Mw== X-Google-Smtp-Source: AGHT+IG1kHGSLZD3bK6XO0ooeia3mD0R5VaMMatLfb60OtCAGElgM2sUxqLh0W2qdxDRl6WivMxs X-Received: by 2002:a05:6214:230e:b0:696:4086:5e1 with SMTP id gc14-20020a056214230e00b00696408605e1mr3414702qvb.2.1712661811020; Tue, 09 Apr 2024 04:23:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712661811; cv=pass; d=google.com; s=arc-20160816; b=N5gOlz9fc3gDrvg1Mhi2JLsLi1JrByGM7vbLQM2ZFNqB2YwhQQMYO6+qQa14P8SDUp 224la3FakWYNDC6VUs5zOxKutRIDiKfoCxhY39dy6KA6O5m6ZUAtJvpbdVWiI4zZZbif zuEtb12XhqekniY0yisCjMGBBu5rzIBtrtx2rwIoQg1+ROrEaqhl7dVrUi9vQK/CCMjj mo9V/+05asIKm02c7T46FLMuvi0wQ3qjchAf2DrSw+AHB5mPudpaJOZS9yM5tPk4cfH0 i+v3dv0p6qKW6dUj3PatiJSuVTJboq1EYea9MmstXr6lcGtWf08stGUZsB4aQBAjRZtm i8vQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=8F8v19+lNA8F19IaULKt3ifweaKAfXQbovzALL2FXbA=; fh=B5R9j38GbAWFBCxucIfhGUtDfsblplNIcSRd+T5N6oU=; b=elmQvR/iyiTr9wzHYWQre+gK4kDMssivfBPxITt0oDbDTbq+M6X0SnS5KkRD27hZvM PTNyWVrqn2Nv4w+FQ8P7zF9YlxA5FYUD3hNachYnYZGZBwW4L8uTLwWXMMkJiwSAKmN0 r3SoqVcx89fJoyQMqyun4g77rAzxdFb5N98QoDrW1Nt9cJzBdlYShPxqnvMY/0zqzV03 PHqPBf1pZd99R11lSZ6XpPA/w4Oq36T3Las14iEOo9v27uKMfp4TnpGm2OenjEiQIa3P +/Ataa7l8UUXhppTukwBZclZN53BQnJz0vhGdO62ghTskfPxeRQeJbjspab1nsWXVC37 fb/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b="iBRm/NIy"; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-136742-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136742-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l10-20020a056214104a00b0069b205f0b91si3021194qvr.252.2024.04.09.04.23.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 04:23:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136742-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b="iBRm/NIy"; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-136742-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136742-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BB4BA1C21CDF for ; Tue, 9 Apr 2024 11:23:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3894286643; Tue, 9 Apr 2024 11:23:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="iBRm/NIy" Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E75658614B for ; Tue, 9 Apr 2024 11:23:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.112 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712661801; cv=none; b=tIqfP5AF1wAOIUwhRNEuZbuc1gK+54gGIecg2d1n6M9VLhCP/RVgDsQn6rHVYLeyhACBHCW4SbegLm1jrLJlrDmejEIkAzR/o/s0yNWDTtu1N9hFiOQRGORqnL7REGM3nLWELbVKsqhXa1qTU9iv1bEF077Zyw9YyqvgcnzMKFk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712661801; c=relaxed/simple; bh=BavaRWHxbElAzWYLUhqQemKOYLqMdzD4eTgpCa6qcSg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=c3179obNE9PBFrsMVaflRbebT+vRPnoW8w+HoFHzE9OQGrgXiYGhToD6iDzN8iDxFDAv2CxXUsyw9eMWhnleWdR9iUuwSQEVCZHt/Djo9ttmd9scgftdWx/uNP7xGO28e7oFa7cUg8Rujca4xRIBwmdwXdU/Bw8BvzPZinHqtIg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=iBRm/NIy; arc=none smtp.client-ip=115.124.30.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1712661791; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=8F8v19+lNA8F19IaULKt3ifweaKAfXQbovzALL2FXbA=; b=iBRm/NIyY0rWI1xtwAIe80mkRRwmOZC0f/iJL2lpKNejGXiicF8gCJWYR5bWBzRSMBFHU/VnPheb+6K76igxcrVQoert1uwQqauVN71kYxEFP/Y3qUoBxJ3QBkQyBm3+2oCXXtZPT8z2UEpoqUxL5Mca/4UOFfmFdmXZAybOu34= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=hongzhen@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0W4ERR40_1712661789; Received: from 30.221.131.136(mailfrom:hongzhen@linux.alibaba.com fp:SMTPD_---0W4ERR40_1712661789) by smtp.aliyun-inc.com; Tue, 09 Apr 2024 19:23:10 +0800 Message-ID: Date: Tue, 9 Apr 2024 19:23:09 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] erofs: derive fsid from on-disk UUID for .statfs() if possible To: Jingbo Xu , xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: huyue2@coolpad.com, dhavale@google.com, linux-kernel@vger.kernel.org References: <20240409081135.6102-1-hongzhen@linux.alibaba.com> <46253829-689c-4f06-8d08-a999c0ddbd1b@linux.alibaba.com> From: Hongzhen Luo In-Reply-To: <46253829-689c-4f06-8d08-a999c0ddbd1b@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2024/4/9 17:36, Jingbo Xu 写道: > > On 4/9/24 4:11 PM, Hongzhen Luo wrote: >> Use the superblock's UUID to generate the fsid when it's non-null. >> >> Signed-off-by: Hongzhen Luo >> --- >> fs/erofs/super.c | 12 +++++------- >> 1 file changed, 5 insertions(+), 7 deletions(-) >> >> diff --git a/fs/erofs/super.c b/fs/erofs/super.c >> index c0eb139adb07..83bd8ee3b5ba 100644 >> --- a/fs/erofs/super.c >> +++ b/fs/erofs/super.c >> @@ -923,22 +923,20 @@ static int erofs_statfs(struct dentry *dentry, struct kstatfs *buf) >> { >> struct super_block *sb = dentry->d_sb; >> struct erofs_sb_info *sbi = EROFS_SB(sb); >> - u64 id = 0; >> - >> - if (!erofs_is_fscache_mode(sb)) >> - id = huge_encode_dev(sb->s_bdev->bd_dev); >> >> buf->f_type = sb->s_magic; >> buf->f_bsize = sb->s_blocksize; >> buf->f_blocks = sbi->total_blocks; >> buf->f_bfree = buf->f_bavail = 0; >> - >> buf->f_files = ULLONG_MAX; >> buf->f_ffree = ULLONG_MAX - sbi->inos; >> - >> buf->f_namelen = EROFS_NAME_LEN; >> >> - buf->f_fsid = u64_to_fsid(id); >> + if (uuid_is_null(&sb->s_uuid)) >> + buf->f_fsid = u64_to_fsid(erofs_is_fscache_mode(sb) ? 0 : >> + huge_encode_dev(sb->s_bdev->bd_dev)); >> + else >> + buf->f_fsid = uuid_to_fsid((__u8 *)&sb->s_uuid); > How about > > buf->f_fsid = uuid_to_fsid(sb->s_uuid.b); > > which looks cleaner. > > Otherwise LGTM. > > Reviewed-by: Jingbo Xu > > Thanks. I will send v2 later. --- Hongzhen