linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 00/15] btrfs: sysfs, cleanups
Date: Tue, 19 Nov 2019 13:37:49 +0100	[thread overview]
Message-ID: <20191119123749.GR3001@twin.jikos.cz> (raw)
In-Reply-To: <99f5241a-bf39-3f12-dfce-29cfafdc5c42@oracle.com>

On Tue, Nov 19, 2019 at 02:44:10PM +0800, Anand Jain wrote:
> 
> 
> On 11/18/19 11:45 PM, David Sterba wrote:
> > On Mon, Nov 18, 2019 at 04:46:41PM +0800, Anand Jain wrote:
> >> Mostly cleanups patches.
> >>
> >> Patches 1-7 are renames, code moves patches and there are no
> >> functional changes.
> >>
> >> Patch 8 drops unused argument in the function btrfs_sysfs_add_fsid().
> >> Patch 9 merges two small functions which is an extension of the other.
> >>
> >> Patches 10,11 and 13 removes unnecessary features in the functions,
> >> originally it was planned to provide sysfs attributes for the scanned
> >> and unmounted devices, as in the un-merged patch in the mailing list [1]
> >>     [1] [PATCH] btrfs: Introduce device pool sysfs attributes
> > 
> > We want something like that,
> 
>   Oh.
> 
>   Ok then I shall relook at these patches with a mind that we might
>   introduce the sysfs for non mounted devices.
> 
> > I don't recall all the past discussions,
> 
>   No worries. There wasn't any discussions on this specific topic.

There were several patchsets sent adding device information exports, and
commented, eg.

https://lore.kernel.org/linux-btrfs/1423439785-10260-1-git-send-email-anand.jain@oracle.com/t/#u
https://lore.kernel.org/linux-btrfs/1416814173-16945-1-git-send-email-anand.jain@oracle.com/t/#u

and maybe followups.

> 
> > but a separate directory for all the new sysfs files should be
> > introduced. Extending the existing /devices/ that contains just the
> > sysfs device like should stay as is.
> > 
> > /sys/fs/btrfs/UUID/
> > 	devinfo/
> > 		1/
> > 			uuid
> > 			state
> > 			...
> > 		2/
> > 			...
> > 
> 
>   umm how about..
> 
> $ btrfs fi show
> Label: none  uuid: 52ad6beb-524d-4cd8-8979-0890d0b74314
> 	Total devices 4 FS bytes used 384.00KiB
> 	devid    1 size 2.93GiB used 368.00MiB path /dev/sdb
> 	devid    2 size 2.93GiB used 368.00MiB path /dev/sdc
> 	devid    3 size 2.93GiB used 368.00MiB path /dev/sdd
> 	devid    4 size 2.93GiB used 368.00MiB path /dev/sde
> 
> 
> # ls -l /sys/fs/btrfs/52ad6beb-524d-4cd8-8979-0890d0b74314/devices/
> total 0
> drwxr-xr-x 2 root root 0 Nov 19 14:39 1_sdb

Something like that has been suggested in the patchsets, I disagree with
the device id and name being glued together. The sysfs files should
server scripting, the enumeration should be straightforward and not
requiring parsing of the filenames.

> drwxr-xr-x 2 root root 0 Nov 19 14:39 2_sdc
> drwxr-xr-x 2 root root 0 Nov 19 14:39 3_sdd
> drwxr-xr-x 2 root root 0 Nov 19 14:39 4_sde
> lrwxrwxrwx 1 root root 0 Nov 19 14:39 sdb -> 
> ../../../../devices/pci0000:00/0000:00:0d.0/ata2/host1/target1:0:0/1:0:0:0/block/sdb
> lrwxrwxrwx 1 root root 0 Nov 19 14:39 sdc -> 
> ../../../../devices/pci0000:00/0000:00:0d.0/ata3/host2/target2:0:0/2:0:0:0/block/sdc
> lrwxrwxrwx 1 root root 0 Nov 19 14:39 sdd -> 
> ../../../../devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdd
> lrwxrwxrwx 1 root root 0 Nov 19 14:39 sde -> 
> ../../../../devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sde

If you want to put the directories under /sys/fs/btrfs/UUID/deevices/
then it's probably ok as long as there device node links are plain files
and the directories represent the ids. But just the ids, the actual
device name depends on the assignment by block layer. This is not
persistent.

So two possible layouts:

fs/UUID/devices
	sda
	sdb
	sdc
	1/
		...
	2/
		...
	3/
		...

Or the one suggested before, where devices by id are in a separate
directory. This is modelled after /dev/disk/by-id and the like, but I
don't think we need to make it granular like that.

  reply	other threads:[~2019-11-19 12:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  8:46 [PATCH 00/15] btrfs: sysfs, cleanups Anand Jain
2019-11-18  8:46 ` [PATCH 01/15] btrfs: sysfs, rename device_link add,remove functions Anand Jain
2019-11-18  8:46 ` [PATCH 02/15] btrfs: sysfs, rename btrfs_sysfs_add_device() Anand Jain
2019-11-18  8:46 ` [PATCH 03/15] btrfs: sysfs, rename btrfs_device member device_dir_kobj Anand Jain
2019-11-18  8:46 ` [PATCH 04/15] btrfs: sysfs, move declared struct near its use Anand Jain
2019-11-18 15:40   ` David Sterba
2019-11-18  8:46 ` [PATCH 05/15] btrfs: sysfs, move /sys/fs/btrfs/UUID related functions together Anand Jain
2019-11-19  9:24   ` Nikolay Borisov
2019-11-19 10:58     ` David Sterba
2019-11-20  5:56       ` Anand Jain
2019-11-22 17:48         ` David Sterba
2019-11-25  3:18           ` Anand Jain
2019-11-18  8:46 ` [PATCH 06/15] btrfs: sysfs, move add remove _mounted function together Anand Jain
2019-11-18  8:46 ` [PATCH 07/15] btrfs: sysfs, delete code in a comment Anand Jain
2019-11-18 15:39   ` David Sterba
2019-11-18  8:46 ` [PATCH 08/15] btrfs: sysfs, btrfs_sysfs_add_fsid() drop unused argument parent Anand Jain
2019-11-18  8:46 ` [PATCH 09/15] btrfs: sysfs, merge btrfs_sysfs_add device_dir and fsid Anand Jain
2019-11-18  8:46 ` [PATCH 10/15] btrfs: volume, btrfs_free_stale_devices() cleanup unreachable code Anand Jain
2019-11-18  8:46 ` [PATCH 11/15] btrfs: sysfs, migrate fs_decvices::fsid_kobject to struct btrfs_fs_info Anand Jain
2019-11-18  8:46 ` [PATCH 12/15] btrfs: sysfs, unexport btrfs_sysfs_add_mounted() Anand Jain
2019-11-18  8:46 ` [PATCH 13/15] btrfs: sysfs, cleanup btrfs_sysfs_remove_fsid() Anand Jain
2019-11-18  8:46 ` [PATCH 14/15] btrfs: sysfs, merge btrfs_sysfs_remove_fsid() helper function Anand Jain
2019-11-18  8:46 ` [PATCH 15/15] btrfs: sysfs, unexport btrfs_sysfs_remove_mounted() Anand Jain
2019-11-18 15:45 ` [PATCH 00/15] btrfs: sysfs, cleanups David Sterba
2019-11-19  6:44   ` Anand Jain
2019-11-19 12:37     ` David Sterba [this message]
2019-11-20  6:44       ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191119123749.GR3001@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).