Commit 1ad17286 authored by Federico Vaga's avatar Federico Vaga Committed by Alessandro Rubini

zdev_get_spinlock: changed and renamed into __get_spinlock

Each zio object gets its own spinlock
Signed-off-by: 's avatarFederico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent e4308edf
......@@ -162,6 +162,7 @@ struct zio_bi {
/* Those using generic_read need this information */
unsigned long flags; /* input or output, etc */
wait_queue_head_t q; /* for reading or writing */
struct spinlock lock;
/* Standard and extended attributes for this object */
struct zio_attribute_set zattr_set;
......
......@@ -38,6 +38,7 @@ struct zio_ti {
struct zio_cset *cset;
unsigned long flags; /* input or output, etc */
struct spinlock lock;
struct zio_control *current_ctrl; /* the active one */
/* This is for software stamping */
struct timespec tstamp;
......
......@@ -352,7 +352,7 @@ static void __zattr_set_free(struct zio_attribute_set *zattr_set)
}
/* When touching attributes, we always use the spinlock for the hosting dev */
static spinlock_t *zdev_get_spinlock(struct zio_obj_head *head)
static spinlock_t *__get_spinlock(struct zio_obj_head *head)
{
spinlock_t *lock;
......@@ -367,10 +367,10 @@ static spinlock_t *zdev_get_spinlock(struct zio_obj_head *head)
lock = &to_zio_chan(&head->kobj)->cset->zdev->lock;
break;
case ZTI: /* we might not want to take a lock but... */
lock = &to_zio_ti(&head->kobj)->cset->zdev->lock;
lock = &to_zio_ti(&head->kobj)->lock;
break;
case ZBI:
lock = &to_zio_bi(&head->kobj)->cset->zdev->lock;
lock = &to_zio_bi(&head->kobj)->lock;
break;
default:
WARN(1, "ZIO: unknown zio object %i\n", head->zobj_type);
......@@ -434,7 +434,7 @@ static ssize_t zattr_show(struct kobject *kobj, struct attribute *attr,
}
if (zattr->s_op->info_get) {
lock = zdev_get_spinlock(to_zio_head(kobj));
lock = __get_spinlock(to_zio_head(kobj));
spin_lock(lock);
err = zattr->s_op->info_get(kobj, zattr, &zattr->value);
spin_unlock(lock);
......@@ -457,7 +457,7 @@ static ssize_t zattr_store(struct kobject *kobj, struct attribute *attr,
if (err)
return -EINVAL;
if (zattr->s_op->conf_set) {
lock = zdev_get_spinlock(to_zio_head(kobj));
lock = __get_spinlock(to_zio_head(kobj));
spin_lock(lock);
err = zattr->s_op->conf_set(kobj, zattr, (uint32_t)val);
spin_unlock(lock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment