Lines Matching refs:acct
116 static void fill_ac(struct bsd_acct_struct *acct);
117 static void acct_write_process(struct bsd_acct_struct *acct);
122 static bool check_free_space(struct bsd_acct_struct *acct) in check_free_space() argument
126 if (!acct->check_space) in check_free_space()
127 return acct->active; in check_free_space()
130 if (vfs_statfs(&acct->file->f_path, &sbuf)) in check_free_space()
131 return acct->active; in check_free_space()
133 if (acct->active) { in check_free_space()
137 acct->active = false; in check_free_space()
144 acct->active = true; in check_free_space()
149 acct->needcheck = jiffies + ACCT_TIMEOUT*HZ; in check_free_space()
150 return acct->active; in check_free_space()
192 struct bsd_acct_struct *acct = to_acct(pin); in acct_pin_kill() local
193 mutex_lock(&acct->lock); in acct_pin_kill()
198 fill_ac(acct); in acct_pin_kill()
199 schedule_work(&acct->work); in acct_pin_kill()
200 wait_for_completion(&acct->done); in acct_pin_kill()
201 cmpxchg(&acct->ns->bacct, pin, NULL); in acct_pin_kill()
202 mutex_unlock(&acct->lock); in acct_pin_kill()
204 acct_put(acct); in acct_pin_kill()
209 struct bsd_acct_struct *acct = container_of(work, struct bsd_acct_struct, work); in close_work() local
210 struct file *file = acct->file; in close_work()
213 acct_write_process(acct); in close_work()
217 complete(&acct->done); in close_work()
225 struct bsd_acct_struct *acct; in acct_on() local
229 acct = kzalloc(sizeof(struct bsd_acct_struct), GFP_KERNEL); in acct_on()
230 if (!acct) in acct_on()
236 kfree(acct); in acct_on()
241 kfree(acct); in acct_on()
248 kfree(acct); in acct_on()
255 kfree(acct); in acct_on()
261 kfree(acct); in acct_on()
267 kfree(acct); in acct_on()
274 kfree(acct); in acct_on()
281 atomic_long_set(&acct->count, 1); in acct_on()
282 init_fs_pin(&acct->pin, acct_pin_kill); in acct_on()
283 acct->file = file; in acct_on()
284 acct->needcheck = jiffies; in acct_on()
285 acct->ns = ns; in acct_on()
286 mutex_init(&acct->lock); in acct_on()
287 INIT_WORK(&acct->work, close_work); in acct_on()
288 init_completion(&acct->done); in acct_on()
289 mutex_lock_nested(&acct->lock, 1); /* nobody has seen it yet */ in acct_on()
290 pin_insert(&acct->pin, mnt); in acct_on()
293 old = xchg(&ns->bacct, &acct->pin); in acct_on()
294 mutex_unlock(&acct->lock); in acct_on()
314 SYSCALL_DEFINE1(acct, const char __user *, name) in SYSCALL_DEFINE1() argument
456 static void fill_ac(struct bsd_acct_struct *acct) in fill_ac() argument
459 struct file *file = acct->file; in fill_ac()
460 acct_t *ac = &acct->ac; in fill_ac()
465 lockdep_assert_held(&acct->lock); in fill_ac()
467 if (time_is_after_jiffies(acct->needcheck)) { in fill_ac()
468 acct->check_space = false; in fill_ac()
471 if (!acct->active) in fill_ac()
474 acct->check_space = true; in fill_ac()
534 struct pid_namespace *ns = acct->ns; in fill_ac()
544 static void acct_write_process(struct bsd_acct_struct *acct) in acct_write_process() argument
546 struct file *file = acct->file; in acct_write_process()
548 acct_t *ac = &acct->ac; in acct_write_process()
559 if (check_free_space(acct) && file_start_write_trylock(file)) { in acct_write_process()
569 static void do_acct_process(struct bsd_acct_struct *acct) in do_acct_process() argument
576 fill_ac(acct); in do_acct_process()
577 acct_write_process(acct); in do_acct_process()
629 struct bsd_acct_struct *acct = acct_get(ns); in slow_acct_process() local
630 if (acct) { in slow_acct_process()
631 do_acct_process(acct); in slow_acct_process()
632 mutex_unlock(&acct->lock); in slow_acct_process()
633 acct_put(acct); in slow_acct_process()