]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vdev_disk: clean up spa/bdev mode conversion
authorRob N <rob.norris@klarasystems.com>
Fri, 29 Mar 2024 21:51:33 +0000 (08:51 +1100)
committerGitHub <noreply@github.com>
Fri, 29 Mar 2024 21:51:33 +0000 (14:51 -0700)
commitcfb96c772b8448dca6eaeb66a540b8bb39c9908c
tree8e1a59165585fbe0f0b7f7f7d0f551cb65aed5a2
parentc0aab8b8f91f5ecb2c625a8fa7265f26c260e10a
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
module/os/linux/zfs/vdev_disk.c