HomeFreeBSD

vdev_disk: clean up spa/bdev mode conversion

Description

vdev_disk: clean up spa/bdev mode conversion

43e8f6e37 introduced a subtle API misuse, in that it passed the output
from vdev_bdev_mode() back into itself. Fortunately, the
SPA_MODE_(READ|WRITE) bit values exactly map to the FMODE_(READ|WRITE) &
BLK_OPEN_(READ|WRITE) bit values, so it didn't result in a bug, but it
was hard to read and understand, so I cleaned it up.

In doing so, I noticed that the only call to vdev_bdev_mode() without
the "exclusive" flag set was in that misuse, and actually, we never do a
non-exclusive blkdev_get_by_path(). So I've just made exclusive be
always-on.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #15995

Details

Provenance
rob.norris_klarasystems.comAuthored on Mar 29 2024, 9:51 PM
Tony Hutter <hutter2@llnl.gov>Committed on Apr 22 2024, 4:23 PM
Parents
rG5dbed504295e: Linux 5.18+ compat: Detect filemap_range_has_page
Branches
Unknown
Tags
Unknown