mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-13 11:40:25 +03:00
cstyle: zvol.c
Update zvol.c to conform to the style guidelines, verified by running cstyle.pl on the source file. This patch contains no functional changes. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ned Bass <bass6@llnl.gov> Signed-off-by: Tim Chase <tim@chase2k.com> Issue #1821
This commit is contained in:
parent
d17eab9ce0
commit
ce37ebd2eb
@ -101,9 +101,9 @@ zvol_find_minor(unsigned *minor)
|
||||
|
||||
/* All minors are in use */
|
||||
if (*minor >= (1 << MINORBITS))
|
||||
return ENXIO;
|
||||
return (SET_ERROR(ENXIO));
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -118,10 +118,10 @@ zvol_find_by_dev(dev_t dev)
|
||||
for (zv = list_head(&zvol_state_list); zv != NULL;
|
||||
zv = list_next(&zvol_state_list, zv)) {
|
||||
if (zv->zv_dev == dev)
|
||||
return zv;
|
||||
return (zv);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -135,11 +135,11 @@ zvol_find_by_name(const char *name)
|
||||
ASSERT(MUTEX_HELD(&zvol_state_lock));
|
||||
for (zv = list_head(&zvol_state_list); zv != NULL;
|
||||
zv = list_next(&zvol_state_list, zv)) {
|
||||
if (!strncmp(zv->zv_name, name, MAXNAMELEN))
|
||||
return zv;
|
||||
if (strncmp(zv->zv_name, name, MAXNAMELEN) == 0)
|
||||
return (zv);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -215,7 +215,7 @@ zvol_get_stats(objset_t *os, nvlist_t *nv)
|
||||
|
||||
error = zap_lookup(os, ZVOL_ZAP_OBJ, "size", 8, 1, &val);
|
||||
if (error)
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_VOLSIZE, val);
|
||||
doi = kmem_alloc(sizeof (dmu_object_info_t), KM_SLEEP);
|
||||
@ -228,7 +228,7 @@ zvol_get_stats(objset_t *os, nvlist_t *nv)
|
||||
|
||||
kmem_free(doi, sizeof (dmu_object_info_t));
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -267,7 +267,7 @@ zvol_update_volsize(zvol_state_t *zv, uint64_t volsize, objset_t *os)
|
||||
error = dmu_tx_assign(tx, TXG_WAIT);
|
||||
if (error) {
|
||||
dmu_tx_abort(tx);
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
error = zap_update(os, ZVOL_ZAP_OBJ, "size", 8, 1,
|
||||
@ -275,12 +275,12 @@ zvol_update_volsize(zvol_state_t *zv, uint64_t volsize, objset_t *os)
|
||||
dmu_tx_commit(tx);
|
||||
|
||||
if (error)
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
|
||||
error = dmu_free_long_range(os,
|
||||
ZVOL_OBJ, volsize, DMU_OBJECT_END);
|
||||
if (error)
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
|
||||
bdev = bdget_disk(zv->zv_disk, 0);
|
||||
if (!bdev)
|
||||
@ -319,7 +319,7 @@ zvol_set_volsize(const char *name, uint64_t volsize)
|
||||
error = dsl_prop_get_integer(name,
|
||||
zfs_prop_to_name(ZFS_PROP_READONLY), &readonly, NULL);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
if (readonly)
|
||||
return (SET_ERROR(EROFS));
|
||||
|
||||
@ -337,8 +337,8 @@ zvol_set_volsize(const char *name, uint64_t volsize)
|
||||
if (error)
|
||||
goto out_doi;
|
||||
|
||||
if ((error = dmu_object_info(os, ZVOL_OBJ, doi)) != 0 ||
|
||||
(error = zvol_check_volsize(volsize,doi->doi_data_block_size)) != 0)
|
||||
if ((error = dmu_object_info(os, ZVOL_OBJ, doi)) ||
|
||||
(error = zvol_check_volsize(volsize, doi->doi_data_block_size)))
|
||||
goto out_doi;
|
||||
|
||||
VERIFY(dsl_prop_get_integer(name, "readonly", &readonly, NULL) == 0);
|
||||
@ -361,7 +361,7 @@ out:
|
||||
|
||||
mutex_exit(&zvol_state_lock);
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -418,7 +418,7 @@ zvol_set_volblocksize(const char *name, uint64_t volblocksize)
|
||||
out:
|
||||
mutex_exit(&zvol_state_lock);
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -448,7 +448,7 @@ zvol_replay_write(zvol_state_t *zv, lr_write_t *lr, boolean_t byteswap)
|
||||
dmu_tx_commit(tx);
|
||||
}
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -486,8 +486,8 @@ zil_replay_func_t zvol_replay_vector[TX_MAX_TYPE] = {
|
||||
ssize_t zvol_immediate_write_sz = 32768;
|
||||
|
||||
static void
|
||||
zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx,
|
||||
uint64_t offset, uint64_t size, int sync)
|
||||
zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, uint64_t offset,
|
||||
uint64_t size, int sync)
|
||||
{
|
||||
uint32_t blocksize = zv->zv_volblocksize;
|
||||
zilog_t *zilog = zv->zv_zilog;
|
||||
@ -869,7 +869,7 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
|
||||
zvol_get_done(zgd, error);
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -969,7 +969,7 @@ out_mutex:
|
||||
if (locked)
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
|
||||
return (-error);
|
||||
return (SET_ERROR(-error));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1035,7 +1035,7 @@ out_mutex:
|
||||
|
||||
check_disk_change(bdev);
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
|
||||
@ -1075,7 +1075,7 @@ zvol_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
int error = 0;
|
||||
|
||||
if (zv == NULL)
|
||||
return (-SET_ERROR(ENXIO));
|
||||
return (SET_ERROR(-ENXIO));
|
||||
|
||||
switch (cmd) {
|
||||
case BLKFLSBUF:
|
||||
@ -1091,7 +1091,7 @@ zvol_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
|
||||
}
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
@ -1099,7 +1099,7 @@ static int
|
||||
zvol_compat_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg)
|
||||
{
|
||||
return zvol_ioctl(bdev, mode, cmd, arg);
|
||||
return (zvol_ioctl(bdev, mode, cmd, arg));
|
||||
}
|
||||
#else
|
||||
#define zvol_compat_ioctl NULL
|
||||
@ -1109,7 +1109,7 @@ static int zvol_media_changed(struct gendisk *disk)
|
||||
{
|
||||
zvol_state_t *zv = disk->private_data;
|
||||
|
||||
return zv->zv_changed;
|
||||
return (zv->zv_changed);
|
||||
}
|
||||
|
||||
static int zvol_revalidate_disk(struct gendisk *disk)
|
||||
@ -1119,7 +1119,7 @@ static int zvol_revalidate_disk(struct gendisk *disk)
|
||||
zv->zv_changed = 0;
|
||||
set_capacity(zv->zv_disk, zv->zv_volsize >> 9);
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1145,7 +1145,7 @@ zvol_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
geo->start = 0;
|
||||
geo->cylinders = sectors / (geo->heads * geo->sectors);
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static struct kobject *
|
||||
@ -1159,7 +1159,7 @@ zvol_probe(dev_t dev, int *part, void *arg)
|
||||
kobj = zv ? get_disk(zv->zv_disk) : NULL;
|
||||
mutex_exit(&zvol_state_lock);
|
||||
|
||||
return kobj;
|
||||
return (kobj);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BDEV_BLOCK_DEVICE_OPERATIONS
|
||||
@ -1179,13 +1179,13 @@ static struct block_device_operations zvol_ops = {
|
||||
static int
|
||||
zvol_open_by_inode(struct inode *inode, struct file *file)
|
||||
{
|
||||
return zvol_open(inode->i_bdev, file->f_mode);
|
||||
return (zvol_open(inode->i_bdev, file->f_mode));
|
||||
}
|
||||
|
||||
static int
|
||||
zvol_release_by_inode(struct inode *inode, struct file *file)
|
||||
{
|
||||
return zvol_release(inode->i_bdev->bd_disk, file->f_mode);
|
||||
return (zvol_release(inode->i_bdev->bd_disk, file->f_mode));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1193,8 +1193,9 @@ zvol_ioctl_by_inode(struct inode *inode, struct file *file,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
if (file == NULL || inode == NULL)
|
||||
return -EINVAL;
|
||||
return zvol_ioctl(inode->i_bdev, file->f_mode, cmd, arg);
|
||||
return (SET_ERROR(-EINVAL));
|
||||
|
||||
return (zvol_ioctl(inode->i_bdev, file->f_mode, cmd, arg));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
@ -1203,9 +1204,10 @@ zvol_compat_ioctl_by_inode(struct file *file,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
if (file == NULL)
|
||||
return -EINVAL;
|
||||
return zvol_compat_ioctl(file->f_dentry->d_inode->i_bdev,
|
||||
file->f_mode, cmd, arg);
|
||||
return (SET_ERROR(-EINVAL));
|
||||
|
||||
return (zvol_compat_ioctl(file->f_dentry->d_inode->i_bdev,
|
||||
file->f_mode, cmd, arg));
|
||||
}
|
||||
#else
|
||||
#define zvol_compat_ioctl_by_inode NULL
|
||||
@ -1279,14 +1281,14 @@ zvol_alloc(dev_t dev, const char *name)
|
||||
snprintf(zv->zv_disk->disk_name, DISK_NAME_LEN, "%s%d",
|
||||
ZVOL_DEV_NAME, (dev & MINORMASK));
|
||||
|
||||
return zv;
|
||||
return (zv);
|
||||
|
||||
out_queue:
|
||||
blk_cleanup_queue(zv->zv_queue);
|
||||
out_kmem:
|
||||
kmem_free(zv, sizeof (zvol_state_t));
|
||||
|
||||
return NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1322,8 +1324,10 @@ __zvol_snapdev_hidden(const char *name)
|
||||
if ((error == 0) && (snapdev == ZFS_SNAPDEV_HIDDEN))
|
||||
error = SET_ERROR(ENODEV);
|
||||
}
|
||||
|
||||
kmem_free(parent, MAXPATHLEN);
|
||||
return (error);
|
||||
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1417,7 +1421,7 @@ out:
|
||||
add_disk(zv->zv_disk);
|
||||
}
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1434,7 +1438,7 @@ zvol_create_minor(const char *name)
|
||||
error = __zvol_create_minor(name, B_FALSE);
|
||||
mutex_exit(&zvol_state_lock);
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1469,7 +1473,7 @@ zvol_remove_minor(const char *name)
|
||||
error = __zvol_remove_minor(name);
|
||||
mutex_exit(&zvol_state_lock);
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1615,7 +1619,6 @@ zvol_set_snapdev(const char *dsname, uint64_t snapdev) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
zvol_init(void)
|
||||
{
|
||||
@ -1623,6 +1626,7 @@ zvol_init(void)
|
||||
|
||||
list_create(&zvol_state_list, sizeof (zvol_state_t),
|
||||
offsetof(zvol_state_t, zv_next));
|
||||
|
||||
mutex_init(&zvol_state_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
|
||||
zvol_taskq = taskq_create(ZVOL_DRIVER, zvol_threads, maxclsyspri,
|
||||
@ -1650,7 +1654,7 @@ out1:
|
||||
mutex_destroy(&zvol_state_lock);
|
||||
list_destroy(&zvol_state_list);
|
||||
|
||||
return (error);
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
void
|
||||
@ -1674,4 +1678,4 @@ module_param(zvol_threads, uint, 0444);
|
||||
MODULE_PARM_DESC(zvol_threads, "Number of threads for zvol device");
|
||||
|
||||
module_param(zvol_max_discard_blocks, ulong, 0444);
|
||||
MODULE_PARM_DESC(zvol_max_discard_blocks, "Max number of blocks to discard at once");
|
||||
MODULE_PARM_DESC(zvol_max_discard_blocks, "Max number of blocks to discard");
|
||||
|
Loading…
Reference in New Issue
Block a user