Only bkeys of the specified type will be printed.
Also, this reworks the error type in bch_bindgen to be able to
represent other kinds of error than just "invalid btree id".
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
If the user passes a single device node during the mount and
we have no information for it in the udev db, we read up the
super block. When we do this, if the FS only has 1 block device
we will simply go ahead and do the mount instead of walking
all the block devices and reading up super blocks looking for
devices with a matching FS UUID.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Introduce an env. variable for users that have a broken blkid which
renders the udev db as incomplete. Only checks for the existence
of the variable, not its value.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
If the udev database contains information about bcachefs, utilize it.
Otherwise, resort to traversing block devices and checking for
bcachefs super blocks.
V2: Reduce number of places we call read_super_slient in interators
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Add an environment variable that indicates we prefer to run bcachefs
code in the kernel, not userspace - this is for the test environment
where it's easier to debug kernel code.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
It is more idiomatic to use `commands::mount` than
`commands::cmd_mount`.
No functionality changes intended by this patch.
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Without the single char (with ':' if optarg expected) only the long
argument string would successfully parse.
For example, now "-lasdf" parses the same as "--label asdf"
We need to check when stdin has been closed - otherwise we'll spin
because select() will return immediately.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
New on disk forat feature - per member 64 bit bitmap of regions with
btree nodes, to accelerate recovering by scanning for btree nodes.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
If we pass a symlink for a single device node we fail to locate the
device node. Canonicalize the device node before we try to read up
the superblock.
This allows the following to work.
# bcachefs mount /dev/mapper/vg-thinvolume /mnt/lv_thin
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Instead of requiring the user to supply all the device nodes for a
multi-device FS, allow them to specifiy 1 of them. We then fetch
the UUID for the FS and then find all the disks on the system that
match this UUID.
This allows me to bring up a bcachefs FS in /etc/fstab by using a
UUID. This works because it appears the mount command looks up
the UUID, finds an entry in /dev/disk/by-uuid and then passes that
found device node to mount.bcachefs which fails with
`insufficient_devices_to_start` as bcachefs is expecting a list of
devices with a ":" between them. This behavior is preserved if a
user specifies a list of all the needed device nodes to bring up
the FS.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This resolves build warnings and failures for architectures where the
Linux userspace `asm/types.h` header defines 64-bit types (u64, s64) as
`long` instead of `long long`.
By defining `__SANE_USERSPACE_TYPES__`, these types are defined as
`long long` instead.
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>