Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1841615lqe; Tue, 9 Apr 2024 01:48:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX5TwWJqmZH5bMWDnb+EUBCikYj7/4f2Lvwy8eYkhGzt/a3lQ6h0peJr3NYYTuaEnVk3cRzQ4nb75wDkRNMn0dDVc/kwUob31teGh4gaA== X-Google-Smtp-Source: AGHT+IEhImSP+v1cZhW+IP70q+yvxUxoGlcu9cpEcI9mrLG2e1kRa/CN9dYjOofm24BlUR1KMnyk X-Received: by 2002:a05:622a:1986:b0:434:7045:129 with SMTP id u6-20020a05622a198600b0043470450129mr9720633qtc.40.1712652484826; Tue, 09 Apr 2024 01:48:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712652484; cv=pass; d=google.com; s=arc-20160816; b=LSLAQEciBSKRh4alV9tzzIwbX2Pzo+1rFwYcUb9cMtA6U5hFCKX7pHnA6yS725SxUJ kADLqZ13sli14cqqRbHfHP9g4ii9gnZ6pk2EwZAN5YcETHPnNy5sibrR0OenJE9hmonG xtuA1oh9pzP8vtYXzIcYbGeMsv5FedjMVeMMB20oKS2y4RO7+0zTmG/9Ml2XPVdGeokq IwlwkLeO0RGM3mWvMPQVGnzd5WiJeQPsX6DVPMMUGqsCzpZIx1/2eOrE4tyCASgeoNtT bMiv8LFKcmqk3+VzajAknoAAxj73LL/SYxv+7qAtgItAV6tFZkfSYqKKes4gSff2gcwc Lyww== 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=NLmQBJY/YAR0kMQs21Xq2pa2nHPXvvDmIRP/f0OQLFw=; fh=3VUDqKo+w/sbfiGGphg4qAxaTfEsKlB1QL5zcIkuC3w=; b=TJYEFcRzC8rVKTeKgHghKkYLgJQs6uxW+ank5T3zIsv9h19BVlxNGJ9kGi7szvFOht alM6vwYCpo1GbfdGVjHLwSlBW1Yy/l4fK/OCwfLKkDNp72I6EwZ02GuVx2sBt6+joHDe JYbjg+g61wNiN27Jt8pOQmS+2RQeG1PRpd3jjq/ged5zUaimPYCrtrM1SLUa323JGWVs oge473WxRUULazBnTSSc62Zt0VlTSn2FjwYkIWr0jRctzwe/L5hmOZarQD5TyKdjusea 1QUs+L3N+nhKiVJCsIGEMGb5UjwE6p5JEopR59GAOttppYZwz+sUMMEyaE333K1z5Xgr wBhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=n+3nZD00; 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-136499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136499-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. [147.75.199.223]) by mx.google.com with ESMTPS id m6-20020a05622a118600b0043466716c89si8828410qtk.581.2024.04.09.01.48.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 01:48:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=n+3nZD00; 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-136499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136499-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 8C0691C21B0A for ; Tue, 9 Apr 2024 08:48:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BD4A7D413; Tue, 9 Apr 2024 08:47:59 +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="n+3nZD00" Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (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 5E9495466E for ; Tue, 9 Apr 2024 08:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.119 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712652477; cv=none; b=K8yzbPWk7ODAIZttO2FZFdIWVf63K7it7tAJz7hgkhr0qFbM+ZFeHUPl2JRuJvNveeO8GQdbWUL5AznA4L+uu5Wca0SPtGxyy/U4492ml4kwFwYlFbA8TvYzowQHIHxjJuxLv+Rz71mqf24djoQWg8Gso+VI2oAFaTnKyufFPF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712652477; c=relaxed/simple; bh=el3TXw5D31KKwUR3W4iZvt+PANl/VSX8X2P72QHQ6I4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ovV1z13iYXZxw5wNR29IBlzYgiH9RKM14h/X3tAd7S0xpeHwH5eN97K0WB3AkIIO8VzgTz4LTmP2OfAp7D9TQ7Uy8NcJKB+GMJtdQlYmfT5knrUaNvDQcr2PLLi1n71wfmThkeia5fWqYjWtiOYAzCGk0Mo8TQGSrakgodfRl/8= 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=n+3nZD00; arc=none smtp.client-ip=115.124.30.119 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=1712652466; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=NLmQBJY/YAR0kMQs21Xq2pa2nHPXvvDmIRP/f0OQLFw=; b=n+3nZD00jTkSfMN5CsxOR+vqo34YQRfEQzuVa7b95pOPeSp/Ph/CBJc3VZHXsu85OthO1bktIIrShcrH5eYuATTYO689WPHetEbzlfacNYc7N3Y2SCX1TVEE12AutkpUVECtHBmFYxmo5J+7uFuBIvWc/sGag8zaBoSOUpNy7GA= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0W4E2Dby_1712652464; Received: from 30.97.48.141(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0W4E2Dby_1712652464) by smtp.aliyun-inc.com; Tue, 09 Apr 2024 16:47:46 +0800 Message-ID: <51fd6e0b-6fa2-4473-b22b-68c11230b2f5@linux.alibaba.com> Date: Tue, 9 Apr 2024 16:47:44 +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: Hongzhen Luo , xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: huyue2@coolpad.com, jefflexu@linux.alibaba.com, dhavale@google.com, linux-kernel@vger.kernel.org References: <20240409081135.6102-1-hongzhen@linux.alibaba.com> From: Gao Xiang In-Reply-To: <20240409081135.6102-1-hongzhen@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/4/9 16:11, Hongzhen Luo wrote: > Use the superblock's UUID to generate the fsid when it's non-null. > > Signed-off-by: Hongzhen Luo Reviewed-by: Gao Xiang Thanks, Gao Xiang > --- > 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); > return 0; > } >