Skip to content

Commit

Permalink
zvol: WIP: volblocksector{size,hint} properties
Browse files Browse the repository at this point in the history
  • Loading branch information
intelfx committed Jan 28, 2025
1 parent 5b62967 commit 3977a5c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ typedef enum {
ZFS_PROP_VOLTHREADING,
ZFS_PROP_DIRECT,
ZFS_PROP_LONGNAME,
ZFS_PROP_VOLBLKSECTORSIZE,
ZFS_PROP_VOLBLKSECTORHINT,
ZFS_NUM_PROPS
} zfs_prop_t;

Expand Down
2 changes: 2 additions & 0 deletions include/sys/zvol.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ extern boolean_t zvol_is_zvol(const char *);
extern void zvol_create_cb(objset_t *, void *, cred_t *, dmu_tx_t *);
extern int zvol_set_volsize(const char *, uint64_t);
extern int zvol_set_volthreading(const char *, boolean_t);
extern int zvol_set_volblksectorsize(const char *, uint64_t);
extern int zvol_set_volblksectorhint(const char *, uint64_t);
extern int zvol_set_common(const char *, zfs_prop_t, zprop_source_t, uint64_t);
extern int zvol_set_ro(const char *, boolean_t);
extern zvol_state_handle_t *zvol_suspend(const char *);
Expand Down
2 changes: 2 additions & 0 deletions include/sys/zvol_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ typedef struct zvol_state {
kcondvar_t zv_removing_cv; /* ready to remove minor */
struct zvol_state_os *zv_zso; /* private platform state */
boolean_t zv_threading; /* volthreading property */
uint64_t zv_sectorsize; /* blkdev logical sector size */
uint64_t zv_sectorhint; /* blkdev physical (hint) sector size */

Check failure on line 61 in include/sys/zvol_impl.h

View workflow job for this annotation

GitHub Actions / checkstyle

line > 80 characters
} zvol_state_t;


Expand Down
6 changes: 6 additions & 0 deletions module/zcommon/zfs_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,12 @@ zfs_prop_init(void)
zprop_register_index(ZFS_PROP_VOLTHREADING, "volthreading",
1, PROP_DEFAULT, ZFS_TYPE_VOLUME, "on | off",
"VOLTHREAD", boolean_table, sfeatures);
zprop_register_number(ZFS_PROP_VOLBLKSECTORSIZE, "volblocksectorsize",
0, PROP_DEFAULT, ZFS_TYPE_VOLUME, "512 to 128k, power of 2",
"VOLBLKSECSIZE", B_FALSE, sfeatures);
zprop_register_number(ZFS_PROP_VOLBLKSECTORHINT, "volblocksectorhint",
0, PROP_DEFAULT, ZFS_TYPE_VOLUME, "512 to 128k, power of 2",
"VOLBLKSECHINT", B_FALSE, sfeatures);

/* inherit number properties */
zprop_register_number(ZFS_PROP_RECORDSIZE, "recordsize",
Expand Down
20 changes: 20 additions & 0 deletions module/zfs/zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,26 @@ zvol_set_volthreading(const char *name, boolean_t value)
return (0);
}

int
zvol_set_volblksectorsize(const char *name, uint64_t value)
{
zvol_state_t *zv = zvol_find_by_name(name, RW_NONE);
if (zv == NULL)
return (ENOENT);
return (EINVAL);
mutex_exit(&zv->zv_state_lock);
}

int
zvol_set_volblksectorhint(const char *name, uint64_t value)
{
zvol_state_t *zv = zvol_find_by_name(name, RW_NONE);
if (zv == NULL)
return (ENOENT);
return (EINVAL);
mutex_exit(&zv->zv_state_lock);
}

/*
* Update zvol ro property.
*/
Expand Down

0 comments on commit 3977a5c

Please sign in to comment.