Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D376127A445 for ; Tue, 24 Jun 2025 09:06:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750755970; cv=none; b=SxHl5pLdSC/WpflhFNd5qrPSTu0s69QSyPr6ggsElbbhLz9fQeAGZXG5FSPZq0NZRN5G89nR1ZXrE4t+d9Yg0t6seWSPfZFZ3gRLD8dDmJYZcCW3FczKPQL5xZQdRvhHCOnc9SxPHJ6gtmXEfLqomPFufEApxGpdbFLgVbUizgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750755970; c=relaxed/simple; bh=uPhY5Zza+vkrnIMPgNzYziK32kqInkX8XjtgEE9coxY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MAoZ4xGdzeq+b8u5Ii/BSXylgHQ2QTZ0Ca/Z6VOpKTKaA9EOxDFYO3KtL7YcuP+PzOr3XyqWGyLpQjJPV27r52oEbHnawWrU8iwXvSPVdCcjXbev9xwvVPBedJbS+MZfV4m/kC7OjfFGiAD6eHdrqDGlhXUXin4RnP2sgWxla0o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=LCaVwYQ1; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="LCaVwYQ1" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3a4f72cba73so3986318f8f.1 for ; Tue, 24 Jun 2025 02:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1750755967; x=1751360767; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=DHWcoiAYJOa0+7KNnNcZSmg0oht47ewTSBLsTJYssfY=; b=LCaVwYQ1MxLzgg8zc0qzkaDLfbgcHqkyPScMTbVo2pLC3M9vLOrLDVYlF0zdBzbbuF W07A3e6mVFFOBjIRwHGCVXj7uc4+PC2vOHzjRKyd0f1hmpDDVr+Nrtba4AlNAVzspb2N 0i/5cSB158tKH6fj1sbyb+qs1FW+xSqKkhJhaMFkVSkYItajmDkhkLNU1njuQpZ7+t0e 4DN3lP7QbB66BK+N6tXv5PTE1y5NFcYVKZZZi3KpOy2UaNPmVVI46fuHflsZAYDUrrte oAUkzCmrdBb4ORgTerqX1avGXRaB1qujV1VIzB+N5rgQdgNNHySv/4WskroZn+V04Fnc xdbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750755967; x=1751360767; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DHWcoiAYJOa0+7KNnNcZSmg0oht47ewTSBLsTJYssfY=; b=mbp0r3spRC25LmE2Ly228Zzkf/X9rx7UCxFcoVBXC3ai1ZKOdgw5kPI7MrXOiNZ5PF Gwg8ls4lp/O2U1h0ULT1lQXai82MiUd5pjrR920OHCNjcKfzXc07mmE+e/bddbksDg0J 98GnfNXGhDaaJXFRfkzIcE/XrMoN/4Pgp0gKjbwcUxdg1j/ePUeVHR5dF06/xDprnB8R p097q237smb0cn9og/NnSw9eaigOOmtv5Pq+MGqGl/WAXnN2RqxKHJ4hVH/Zq5zw0g7l +Hfk7Zp9+wmgd5hoMG4WIG2Cv0vh4PoupbGf/UdnDEM3PPAt3jcYlVQ9GyqTRjy70TK0 usQw== X-Forwarded-Encrypted: i=1; AJvYcCXyY2TsoPTtXk4Bua4hKRg0I9BUF1nxNpaXwol+uXkfLbntSJNoGbY9WQ0bY9YEbtJyeHq/M0sPp7eqrg==@vger.kernel.org X-Gm-Message-State: AOJu0YyDQeVxd3h9sPzOqW+Fza3IxLiobRK2x9xY8Er+HvYtxPwUcPf5 /rz8UlpwpAPxrvfTFRd3AMWvpVBlzDvarZhplubo4px+9WN5GwdHjIKYFQBV5Ky6XSWL+lJfnxb 9CV8a X-Gm-Gg: ASbGncsnS7PI7OZIk3BKSTAs2cYu9UnRM84Zs7OyCIABKoZ1hVAdMxCLonHYIFXfsjl WXX6uQE5sN6vewqzIUFNWU9dLmTHoQsF45GU0fyqlXB80+hx6buAkIbxaDpvtzpEX6mXMZLc/6F pBHAcXHTYd8YJMuIwEsR4lbv7Sh07XudPRZgC2BwWDBAqapNEUFTT0x6LUB2q3g9sYAsaSzbuMe T3tX5UBPd8GTyxGUl55mVhiy00rnaiaS9K0KmuLsOjAmV/1Zyq7P/L6W63pYy0loz6vn2V8cZTT RqM9iIDu/JV1Ic9xQ22d+lgzckHv/Qkp6D630gSAaHy2Nu4CFOU/shzgbE7p8YqR62/HqHkIMAo zl5HN6tbHoEkZtw== X-Google-Smtp-Source: AGHT+IHt1CghqLrmgenA0n5fZVf5QwIrBcdRezEwkp7DF7SGAA3wlRjWDCdNhOIS5p86WcawFevWBQ== X-Received: by 2002:a05:6000:430c:b0:3a3:598f:5a97 with SMTP id ffacd0b85a97d-3a6e71c5b60mr1850925f8f.9.1750755966919; Tue, 24 Jun 2025 02:06:06 -0700 (PDT) Received: from ?IPV6:2403:580d:fda1::299? (2403-580d-fda1--299.ip6.aussiebb.net. [2403:580d:fda1::299]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3159df71ccbsm10270564a91.10.2025.06.24.02.06.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Jun 2025 02:06:06 -0700 (PDT) Message-ID: <8db82a80-242f-41ff-84b8-601d6dcd9b9d@suse.com> Date: Tue, 24 Jun 2025 18:36:01 +0930 Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 5/6] fs: introduce a shutdown_bdev super block operation To: Christian Brauner Cc: Christoph Hellwig , Jan Kara , linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk References: <20250623-worte-idolisieren-75354608512a@brauner> <84d61295-9c4a-41e8-80f0-dcf56814d0ae@suse.com> <20250624-geerntet-haare-2ce4cc42b026@brauner> Content-Language: en-US From: Qu Wenruo Autocrypt: addr=wqu@suse.com; keydata= xsBNBFnVga8BCACyhFP3ExcTIuB73jDIBA/vSoYcTyysFQzPvez64TUSCv1SgXEByR7fju3o 8RfaWuHCnkkea5luuTZMqfgTXrun2dqNVYDNOV6RIVrc4YuG20yhC1epnV55fJCThqij0MRL 1NxPKXIlEdHvN0Kov3CtWA+R1iNN0RCeVun7rmOrrjBK573aWC5sgP7YsBOLK79H3tmUtz6b 9Imuj0ZyEsa76Xg9PX9Hn2myKj1hfWGS+5og9Va4hrwQC8ipjXik6NKR5GDV+hOZkktU81G5 gkQtGB9jOAYRs86QG/b7PtIlbd3+pppT0gaS+wvwMs8cuNG+Pu6KO1oC4jgdseFLu7NpABEB AAHNGFF1IFdlbnJ1byA8d3F1QHN1c2UuY29tPsLAlAQTAQgAPgIbAwULCQgHAgYVCAkKCwIE FgIDAQIeAQIXgBYhBC3fcuWlpVuonapC4cI9kfOhJf6oBQJnEXVgBQkQ/lqxAAoJEMI9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AXek8MF37R8gpLoGWl41FIUb3hFiu3zhDDvslYM4BmzI18QgQTQnotJH8= In-Reply-To: <20250624-geerntet-haare-2ce4cc42b026@brauner> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2025/6/24 18:21, Christian Brauner 写道: > On Tue, Jun 24, 2025 at 06:57:08AM +0930, Qu Wenruo wrote: >> >> >> 在 2025/6/23 23:27, Christoph Hellwig 写道: >>> On Mon, Jun 23, 2025 at 12:56:28PM +0200, Christian Brauner wrote: >>>> void (*shutdown)(struct super_block *sb); >>>> + void (*drop_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */); >>>> }; >>>> >>>> You might want to drop a block device independent of whether the device >>>> was somehow lost. So I find that a bit more flexible. >>> >>> Drop is weird word for what is happening here, and if it wasn't for the >>> context in this thread I'd expect it to be about refcounting in Linux. >>> >>> When the VFS/libfs does an upcall into the file system to notify it >>> that a device is gone that's pretty much a device loss. I'm not married >>> to the exact name, but drop seems like a pretty bad choice. >> >> What about a more common used term, mark_dead()? >> >> It's already used in blk_holder_ops, and I'd say it's more straighforward to >> me, compared to shutdown()/goingdown(). > > But it's not about the superblock going down necessarily. It's about the > device going away for whatever reason: > > void (*yank_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */); > void (*pull_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */); > void (*unplug_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */); > void (*remove_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */); All sound good to me, although the last one sounds better. > > On a single device superblock unplugging that device would obviously > cause an actual shutdown. On multi-device superblocks it doesn't always. > > (That brings me to another thought. Is there a use-case for knowing in > advance whether removing a device would shut down the superblock? Maybe another interface like can_remove_bdev()? It's not hard for btrfs to provide it, we already have a check function btrfs_check_rw_degradable() to do that. Although I'd say, that will be something way down the road. We even don't have a proper way to let end user configure the device loss behavior. E.g. some end users may prefer a full shutdown to be extra cautious, other than continue degraded. Thanks, Qu > Because then the ability to probe whether a device can be safely > removed or an option to only remove the device if it can be removed > without killing the superblock would be a natural extension.)