Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1828480lqe; Tue, 9 Apr 2024 01:12:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVkLvwyha1GWu0XOFWw2TkdFIbo+e4xd4QdMyoHenk6r8Z2OTouLirUiX/w3uVTpOAd4qpFwN6sHtuB8AggE4449tVGIeeKqi5XjfRVuA== X-Google-Smtp-Source: AGHT+IF/ycd8lFKW21rf1m11dFrLIqrqCWON/XIEtKq1nUFDR7p4eezK637sM4cw0UMR5vVgeVLq X-Received: by 2002:a05:622a:286:b0:434:8bc3:e1d8 with SMTP id z6-20020a05622a028600b004348bc3e1d8mr6842385qtw.56.1712650370878; Tue, 09 Apr 2024 01:12:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712650370; cv=pass; d=google.com; s=arc-20160816; b=XF2SrHwakRGgdeSWVjAXvCG0AsEE17MmIVY56STTLm4jRAo/yS/XmfQC0i1T7FGJ8c DYWgjfC32UcybAgLBjekAMraNjyOhCExzVk/kZBSAQb2bTfaNZtk+8Li+wfxENMiJJPo V1VwqcMVhhfUEZBdqC3GRaf0/Nfa0mZ/Snj4fFrYI/UYRw8JJd/oT58FyKJKDZ68Dlp3 0q5cn4J44HCIpTMPrPkFume0hrrrjIaq5q4S5U0CyMhXsy5D+NCj8hg8XGggGgfruvN6 D7tqYzo3NqKF7bE98u4V8CS/OK6z14of0lmrkwpT4wl22MKKqpttWUIInjpicjnij2HL 5wHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=89xpcFLgtVH4lcATuVDEdqCce7EFZbuNNRadjDj3dIM=; fh=Ix6WqrQv9hCCMCpFr+eyAK11DfN9/9z6JV3i28nZZho=; b=lqH5jlNvG+BZk3mzavvRSBU6MVzzqESNYHjrHejXvcsa8fHvnPTHEiEVM9c3g+Xrlh bHiRXTeQeDrrcRXfjmrCXhksf7wgpNgEJbP0BtXjPDYTAqg92FmFnYpSE4EkHK/q7vfg J9EAZyi99omQwKhve0gW6HrjsrQYhDMqJuI3l5Y34LtNW34DDPChmsQMj/3wV/sRDlZ2 /+e5OGTGL+p6L+Xi8zkULcE0DRt+B/FvmruQ2E62IYhRQI0ESmXBeG8oI6C7zZA3fGg2 DAJR9CcmjWmBnQrGCDwjU1g0/G/xXlJZqZodxnas1DgFuV35c+Q9/yd/rMMl0Ld9B7Gu QWPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=hbG4V3kt; 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-136419-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136419-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 dr16-20020a05622a529000b00434b19ff497si2667962qtb.714.2024.04.09.01.12.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 01:12:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136419-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=hbG4V3kt; 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-136419-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136419-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 8CC791C225B3 for ; Tue, 9 Apr 2024 08:12:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3B5A7F7DB; Tue, 9 Apr 2024 08:11:45 +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="hbG4V3kt" Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (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 6CEC37F7F4 for ; Tue, 9 Apr 2024 08:11:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712650305; cv=none; b=EmDysqJ0AhFS+qsK7PZ6XrtCjts86HmmQCYb37MLBnI26Hrd94W/l5i6M7BANMhoY77g7MOJTMJpeyouXpVdjHCQhmQZBF1/ua7Jfe5sXXP2r+nmWceWVvWfw3I+CYJy6VL6AV7akBgzKYNQ2wMfSriwykuNFKiaOsbmtAHdJF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712650305; c=relaxed/simple; bh=+aw7U+mPGyyIrnXa9PNm0Q0W2Q65jpN/hN/rR612pPc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=QpUCABUHgb5yntK+RcSqbq+g5H6VtMPtoHodmgSnbJbt+CLA1RyCrOAnVomiyUL38yQZTKwHB2Bq8Q6hY/bPwgA9RLtcCCcFP+T80sDYm6XovmDmHjSnsuKqJUiFrhj4HGZKC5IVcRZbhnX89mbmuTOzVKIsVYRyeHH9atL8rNg= 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=hbG4V3kt; arc=none smtp.client-ip=115.124.30.101 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=1712650299; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=89xpcFLgtVH4lcATuVDEdqCce7EFZbuNNRadjDj3dIM=; b=hbG4V3kt6TWsMygWs75e+enp+t8m/Q9aXrOoZK8+ykchB7WEZYrzzZgMaS1Od5DoKZZmR5NytJZTPlkKr6LSvPmvtUheUfQz0FJy8Rwz/uD7DU7ScuJHuq2i6fAOHC9nC7TnT64iP37+P+RMhTN4o9MHQo9kRffe9OZL9FoT2tM= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=hongzhen@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0W4DtF.b_1712650297; Received: from localhost(mailfrom:hongzhen@linux.alibaba.com fp:SMTPD_---0W4DtF.b_1712650297) by smtp.aliyun-inc.com; Tue, 09 Apr 2024 16:11:38 +0800 From: Hongzhen Luo To: 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, Hongzhen Luo Subject: [PATCH] erofs: derive fsid from on-disk UUID for .statfs() if possible Date: Tue, 9 Apr 2024 16:11:35 +0800 Message-Id: <20240409081135.6102-1-hongzhen@linux.alibaba.com> X-Mailer: git-send-email 2.37.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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); return 0; } -- 2.37.1