Skip to content

Commit be42ee0

Browse files
Luke Beirnecalccrypto
authored andcommitted
get_bdev Function
Adds a function that returns the correct block device handle from the vdev_disk_t struct defined in vdev_disk.c. The purpose of this addition is to use this function to get the block device handle to pass to zia_disk_open from zia_open_vdevs, which currently just casts a vdev_disk_t object to a block device *, leading to failure if the operation does not fallback. Signed-off-by: Luke Beirne <lbeirne@lanl.gov>
1 parent 6917b2f commit be42ee0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/sys/vdev_disk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <sys/vdev.h>
4646

4747
#ifdef __linux__
48+
struct block_device *get_bdev(void *tsd);
4849
int __vdev_classic_physio(struct block_device *bdev, zio_t *zio,
4950
size_t io_size, uint64_t io_offset, int rw, int flags);
5051
int vdev_disk_io_flush(struct block_device *bdev, zio_t *zio);

module/os/linux/zfs/vdev_disk.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ typedef fmode_t vdev_bdev_mode_t;
124124
#define VDEV_BDEV_MODE_MASK (FMODE_READ|FMODE_WRITE|FMODE_EXCL)
125125
#endif
126126

127+
struct block_device *
128+
get_bdev(void *tsd)
129+
{
130+
return (BDH_BDEV(((vdev_disk_t *)tsd)->vd_bdh));
131+
}
132+
127133
static vdev_bdev_mode_t
128134
vdev_bdev_mode(spa_mode_t smode)
129135
{

0 commit comments

Comments
 (0)