*/
static void do_acct_process(struct bsd_acct_struct *acct);
-struct bsd_acct_struct {
+struct fs_pin {
atomic_long_t count;
union {
struct {
};
struct rcu_head rcu;
};
+};
+
+struct bsd_acct_struct {
+ struct fs_pin pin;
struct mutex lock;
int active;
unsigned long needcheck;
struct completion done;
};
-static void acct_free_rcu(struct rcu_head *head)
+static void pin_free_rcu(struct rcu_head *head)
{
- kfree(container_of(head, struct bsd_acct_struct, rcu));
+ kfree(container_of(head, struct fs_pin, rcu));
}
static DEFINE_SPINLOCK(acct_lock);
return acct->active;
}
-static void acct_put(struct bsd_acct_struct *p)
+static void pin_put(struct fs_pin *p)
{
if (atomic_long_dec_and_test(&p->count))
- call_rcu(&p->rcu, acct_free_rcu);
+ call_rcu(&p->rcu, pin_free_rcu);
}
static struct bsd_acct_struct *__acct_get(struct bsd_acct_struct *res)
{
- if (!atomic_long_inc_not_zero(&res->count)) {
+ if (!atomic_long_inc_not_zero(&res->pin.count)) {
rcu_read_unlock();
cpu_relax();
return NULL;
mutex_lock(&res->lock);
if (!res->ns) {
mutex_unlock(&res->lock);
- acct_put(res);
+ pin_put(&res->pin);
return NULL;
}
return res;
schedule_work(&acct->work);
wait_for_completion(&acct->done);
spin_lock(&acct_lock);
- hlist_del(&acct->m_list);
- hlist_del(&acct->s_list);
+ hlist_del(&acct->pin.m_list);
+ hlist_del(&acct->pin.s_list);
spin_unlock(&acct_lock);
ns->bacct = new;
if (new) {
struct vfsmount *m = new->file->f_path.mnt;
spin_lock(&acct_lock);
- hlist_add_head(&new->s_list, &m->mnt_sb->s_pins);
- hlist_add_head(&new->m_list, &real_mount(m)->mnt_pins);
+ hlist_add_head(&new->pin.s_list, &m->mnt_sb->s_pins);
+ hlist_add_head(&new->pin.m_list, &real_mount(m)->mnt_pins);
spin_unlock(&acct_lock);
mutex_unlock(&new->lock);
}
acct->ns = NULL;
- atomic_long_dec(&acct->count);
+ atomic_long_dec(&acct->pin.count);
mutex_unlock(&acct->lock);
- acct_put(acct);
+ pin_put(&acct->pin);
}
}
return -EIO;
}
- atomic_long_set(&acct->count, 1);
+ atomic_long_set(&acct->pin.count, 1);
acct->file = file;
acct->needcheck = jiffies;
acct->ns = ns;
} else {
ns->bacct = acct;
spin_lock(&acct_lock);
- hlist_add_head(&acct->s_list, &mnt->mnt_sb->s_pins);
- hlist_add_head(&acct->m_list, &real_mount(mnt)->mnt_pins);
+ hlist_add_head(&acct->pin.s_list, &mnt->mnt_sb->s_pins);
+ hlist_add_head(&acct->pin.m_list, &real_mount(mnt)->mnt_pins);
spin_unlock(&acct_lock);
mutex_unlock(&acct->lock);
}
break;
acct_kill(__acct_get(hlist_entry(p,
struct bsd_acct_struct,
- m_list)), NULL);
+ pin.m_list)), NULL);
rcu_read_lock();
}
rcu_read_unlock();
break;
acct_kill(__acct_get(hlist_entry(p,
struct bsd_acct_struct,
- s_list)), NULL);
+ pin.s_list)), NULL);
rcu_read_lock();
}
rcu_read_unlock();
if (acct) {
do_acct_process(acct);
mutex_unlock(&acct->lock);
- acct_put(acct);
+ pin_put(&acct->pin);
}
}
}