Lines Matching refs:dquot
275 static inline void insert_dquot_hash(struct dquot *dquot) in insert_dquot_hash() argument
278 head = dquot_hash + hashfn(dquot->dq_sb, dquot->dq_id); in insert_dquot_hash()
279 hlist_add_head(&dquot->dq_hash, head); in insert_dquot_hash()
282 static inline void remove_dquot_hash(struct dquot *dquot) in remove_dquot_hash() argument
284 hlist_del_init(&dquot->dq_hash); in remove_dquot_hash()
287 static struct dquot *find_dquot(unsigned int hashent, struct super_block *sb, in find_dquot()
291 struct dquot *dquot; in find_dquot() local
294 dquot = hlist_entry(node, struct dquot, dq_hash); in find_dquot()
295 if (dquot->dq_sb == sb && qid_eq(dquot->dq_id, qid)) in find_dquot()
296 return dquot; in find_dquot()
302 static inline void put_dquot_last(struct dquot *dquot) in put_dquot_last() argument
304 list_add_tail(&dquot->dq_free, &free_dquots); in put_dquot_last()
308 static inline void remove_free_dquot(struct dquot *dquot) in remove_free_dquot() argument
310 if (list_empty(&dquot->dq_free)) in remove_free_dquot()
312 list_del_init(&dquot->dq_free); in remove_free_dquot()
316 static inline void put_inuse(struct dquot *dquot) in put_inuse() argument
320 list_add_tail(&dquot->dq_inuse, &inuse_list); in put_inuse()
324 static inline void remove_inuse(struct dquot *dquot) in remove_inuse() argument
327 list_del(&dquot->dq_inuse); in remove_inuse()
333 static void wait_on_dquot(struct dquot *dquot) in wait_on_dquot() argument
335 mutex_lock(&dquot->dq_lock); in wait_on_dquot()
336 mutex_unlock(&dquot->dq_lock); in wait_on_dquot()
339 static inline int dquot_dirty(struct dquot *dquot) in dquot_dirty() argument
341 return test_bit(DQ_MOD_B, &dquot->dq_flags); in dquot_dirty()
344 static inline int mark_dquot_dirty(struct dquot *dquot) in mark_dquot_dirty() argument
346 return dquot->dq_sb->dq_op->mark_dirty(dquot); in mark_dquot_dirty()
350 int dquot_mark_dquot_dirty(struct dquot *dquot) in dquot_mark_dquot_dirty() argument
354 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) in dquot_mark_dquot_dirty()
357 if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NOLIST_DIRTY) in dquot_mark_dquot_dirty()
358 return test_and_set_bit(DQ_MOD_B, &dquot->dq_flags); in dquot_mark_dquot_dirty()
361 if (test_bit(DQ_MOD_B, &dquot->dq_flags)) in dquot_mark_dquot_dirty()
365 if (!test_and_set_bit(DQ_MOD_B, &dquot->dq_flags)) { in dquot_mark_dquot_dirty()
366 list_add(&dquot->dq_dirty, &sb_dqopt(dquot->dq_sb)-> in dquot_mark_dquot_dirty()
367 info[dquot->dq_id.type].dqi_dirty_list); in dquot_mark_dquot_dirty()
376 static inline int mark_all_dquot_dirty(struct dquot * const *dquot) in mark_all_dquot_dirty() argument
382 if (dquot[cnt]) in mark_all_dquot_dirty()
384 ret = mark_dquot_dirty(dquot[cnt]); in mark_all_dquot_dirty()
391 static inline void dqput_all(struct dquot **dquot) in dqput_all() argument
396 dqput(dquot[cnt]); in dqput_all()
399 static inline int clear_dquot_dirty(struct dquot *dquot) in clear_dquot_dirty() argument
401 if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NOLIST_DIRTY) in clear_dquot_dirty()
402 return test_and_clear_bit(DQ_MOD_B, &dquot->dq_flags); in clear_dquot_dirty()
405 if (!test_and_clear_bit(DQ_MOD_B, &dquot->dq_flags)) { in clear_dquot_dirty()
409 list_del_init(&dquot->dq_dirty); in clear_dquot_dirty()
426 int dquot_acquire(struct dquot *dquot) in dquot_acquire() argument
429 struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); in dquot_acquire()
431 mutex_lock(&dquot->dq_lock); in dquot_acquire()
432 if (!test_bit(DQ_READ_B, &dquot->dq_flags)) { in dquot_acquire()
433 ret = dqopt->ops[dquot->dq_id.type]->read_dqblk(dquot); in dquot_acquire()
439 set_bit(DQ_READ_B, &dquot->dq_flags); in dquot_acquire()
441 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && !dquot->dq_off) { in dquot_acquire()
442 ret = dqopt->ops[dquot->dq_id.type]->commit_dqblk(dquot); in dquot_acquire()
444 if (info_dirty(&dqopt->info[dquot->dq_id.type])) { in dquot_acquire()
445 ret2 = dqopt->ops[dquot->dq_id.type]->write_file_info( in dquot_acquire()
446 dquot->dq_sb, dquot->dq_id.type); in dquot_acquire()
460 set_bit(DQ_ACTIVE_B, &dquot->dq_flags); in dquot_acquire()
462 mutex_unlock(&dquot->dq_lock); in dquot_acquire()
470 int dquot_commit(struct dquot *dquot) in dquot_commit() argument
473 struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); in dquot_commit()
475 mutex_lock(&dquot->dq_lock); in dquot_commit()
476 if (!clear_dquot_dirty(dquot)) in dquot_commit()
480 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) in dquot_commit()
481 ret = dqopt->ops[dquot->dq_id.type]->commit_dqblk(dquot); in dquot_commit()
485 mutex_unlock(&dquot->dq_lock); in dquot_commit()
493 int dquot_release(struct dquot *dquot) in dquot_release() argument
496 struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); in dquot_release()
498 mutex_lock(&dquot->dq_lock); in dquot_release()
500 if (dquot_is_busy(dquot)) in dquot_release()
502 if (dqopt->ops[dquot->dq_id.type]->release_dqblk) { in dquot_release()
503 ret = dqopt->ops[dquot->dq_id.type]->release_dqblk(dquot); in dquot_release()
505 if (info_dirty(&dqopt->info[dquot->dq_id.type])) { in dquot_release()
506 ret2 = dqopt->ops[dquot->dq_id.type]->write_file_info( in dquot_release()
507 dquot->dq_sb, dquot->dq_id.type); in dquot_release()
512 clear_bit(DQ_ACTIVE_B, &dquot->dq_flags); in dquot_release()
514 mutex_unlock(&dquot->dq_lock); in dquot_release()
519 void dquot_destroy(struct dquot *dquot) in dquot_destroy() argument
521 kmem_cache_free(dquot_cachep, dquot); in dquot_destroy()
525 static inline void do_destroy_dquot(struct dquot *dquot) in do_destroy_dquot() argument
527 dquot->dq_sb->dq_op->destroy_dquot(dquot); in do_destroy_dquot()
538 struct dquot *dquot, *tmp; in invalidate_dquots() local
542 list_for_each_entry_safe(dquot, tmp, &inuse_list, dq_inuse) { in invalidate_dquots()
543 if (dquot->dq_sb != sb) in invalidate_dquots()
545 if (dquot->dq_id.type != type) in invalidate_dquots()
548 if (atomic_read(&dquot->dq_count)) { in invalidate_dquots()
549 dqgrab(dquot); in invalidate_dquots()
560 atomic_read(&dquot->dq_count) == 1); in invalidate_dquots()
561 dqput(dquot); in invalidate_dquots()
571 remove_dquot_hash(dquot); in invalidate_dquots()
572 remove_free_dquot(dquot); in invalidate_dquots()
573 remove_inuse(dquot); in invalidate_dquots()
574 do_destroy_dquot(dquot); in invalidate_dquots()
581 int (*fn)(struct dquot *dquot, unsigned long priv), in dquot_scan_active() argument
584 struct dquot *dquot, *old_dquot = NULL; in dquot_scan_active() local
590 list_for_each_entry(dquot, &inuse_list, dq_inuse) { in dquot_scan_active()
591 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) in dquot_scan_active()
593 if (dquot->dq_sb != sb) in dquot_scan_active()
596 atomic_inc(&dquot->dq_count); in dquot_scan_active()
600 old_dquot = dquot; in dquot_scan_active()
606 wait_on_dquot(dquot); in dquot_scan_active()
607 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { in dquot_scan_active()
608 ret = fn(dquot, priv); in dquot_scan_active()
627 struct dquot *dquot; in dquot_writeback_dquots() local
643 dquot = list_first_entry(&dirty, struct dquot, in dquot_writeback_dquots()
646 WARN_ON(!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)); in dquot_writeback_dquots()
651 dqgrab(dquot); in dquot_writeback_dquots()
654 err = sb->dq_op->write_dquot(dquot); in dquot_writeback_dquots()
660 clear_dquot_dirty(dquot); in dquot_writeback_dquots()
664 dqput(dquot); in dquot_writeback_dquots()
721 struct dquot *dquot; in dqcache_shrink_scan() local
726 dquot = list_first_entry(&free_dquots, struct dquot, dq_free); in dqcache_shrink_scan()
727 remove_dquot_hash(dquot); in dqcache_shrink_scan()
728 remove_free_dquot(dquot); in dqcache_shrink_scan()
729 remove_inuse(dquot); in dqcache_shrink_scan()
730 do_destroy_dquot(dquot); in dqcache_shrink_scan()
754 void dqput(struct dquot *dquot) in dqput() argument
758 if (!dquot) in dqput()
761 if (!atomic_read(&dquot->dq_count)) { in dqput()
762 quota_error(dquot->dq_sb, "trying to free free dquot of %s %d", in dqput()
763 quotatypes[dquot->dq_id.type], in dqput()
764 from_kqid(&init_user_ns, dquot->dq_id)); in dqput()
771 if (atomic_read(&dquot->dq_count) > 1) { in dqput()
773 atomic_dec(&dquot->dq_count); in dqput()
775 if (!sb_has_quota_active(dquot->dq_sb, dquot->dq_id.type) && in dqput()
776 atomic_read(&dquot->dq_count) == 1) in dqput()
782 if (dquot_dirty(dquot)) { in dqput()
785 ret = dquot->dq_sb->dq_op->write_dquot(dquot); in dqput()
787 quota_error(dquot->dq_sb, "Can't write quota structure" in dqput()
794 clear_dquot_dirty(dquot); in dqput()
798 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { in dqput()
800 dquot->dq_sb->dq_op->release_dquot(dquot); in dqput()
803 atomic_dec(&dquot->dq_count); in dqput()
806 BUG_ON(!list_empty(&dquot->dq_free)); in dqput()
808 put_dquot_last(dquot); in dqput()
813 struct dquot *dquot_alloc(struct super_block *sb, int type) in dquot_alloc()
819 static struct dquot *get_empty_dquot(struct super_block *sb, int type) in get_empty_dquot()
821 struct dquot *dquot; in get_empty_dquot() local
823 dquot = sb->dq_op->alloc_dquot(sb, type); in get_empty_dquot()
824 if(!dquot) in get_empty_dquot()
827 mutex_init(&dquot->dq_lock); in get_empty_dquot()
828 INIT_LIST_HEAD(&dquot->dq_free); in get_empty_dquot()
829 INIT_LIST_HEAD(&dquot->dq_inuse); in get_empty_dquot()
830 INIT_HLIST_NODE(&dquot->dq_hash); in get_empty_dquot()
831 INIT_LIST_HEAD(&dquot->dq_dirty); in get_empty_dquot()
832 dquot->dq_sb = sb; in get_empty_dquot()
833 dquot->dq_id = make_kqid_invalid(type); in get_empty_dquot()
834 atomic_set(&dquot->dq_count, 1); in get_empty_dquot()
835 spin_lock_init(&dquot->dq_dqb_lock); in get_empty_dquot()
837 return dquot; in get_empty_dquot()
848 struct dquot *dqget(struct super_block *sb, struct kqid qid) in dqget()
851 struct dquot *dquot, *empty = NULL; in dqget() local
864 dquot = ERR_PTR(-ESRCH); in dqget()
869 dquot = find_dquot(hashent, sb, qid); in dqget()
870 if (!dquot) { in dqget()
878 dquot = empty; in dqget()
880 dquot->dq_id = qid; in dqget()
882 put_inuse(dquot); in dqget()
884 insert_dquot_hash(dquot); in dqget()
888 if (!atomic_read(&dquot->dq_count)) in dqget()
889 remove_free_dquot(dquot); in dqget()
890 atomic_inc(&dquot->dq_count); in dqget()
897 wait_on_dquot(dquot); in dqget()
899 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { in dqget()
902 err = sb->dq_op->acquire_dquot(dquot); in dqget()
904 dqput(dquot); in dqget()
905 dquot = ERR_PTR(err); in dqget()
915 BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */ in dqget()
921 return dquot; in dqget()
925 static inline struct dquot **i_dquot(struct inode *inode) in i_dquot()
932 struct dquot * const *dquots; in dqinit_needed()
1012 struct dquot **dquots = i_dquot(inode); in remove_inode_dquot_ref()
1013 struct dquot *dquot = dquots[type]; in remove_inode_dquot_ref() local
1015 if (!dquot) in remove_inode_dquot_ref()
1019 if (list_empty(&dquot->dq_free)) { in remove_inode_dquot_ref()
1025 list_add(&dquot->dq_free, tofree_head); in remove_inode_dquot_ref()
1032 dqput(dquot); in remove_inode_dquot_ref()
1044 struct dquot *dquot; in put_dquot_list() local
1048 dquot = list_entry(act_head, struct dquot, dq_free); in put_dquot_list()
1051 list_del_init(&dquot->dq_free); in put_dquot_list()
1052 dqput(dquot); in put_dquot_list()
1105 void dquot_free_reserved_space(struct dquot *dquot, qsize_t number) in dquot_free_reserved_space() argument
1107 if (dquot->dq_dqb.dqb_rsvspace >= number) in dquot_free_reserved_space()
1108 dquot->dq_dqb.dqb_rsvspace -= number; in dquot_free_reserved_space()
1111 dquot->dq_dqb.dqb_rsvspace = 0; in dquot_free_reserved_space()
1113 if (dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace <= in dquot_free_reserved_space()
1114 dquot->dq_dqb.dqb_bsoftlimit) in dquot_free_reserved_space()
1115 dquot->dq_dqb.dqb_btime = (time64_t) 0; in dquot_free_reserved_space()
1116 clear_bit(DQ_BLKS_B, &dquot->dq_flags); in dquot_free_reserved_space()
1119 static void dquot_decr_inodes(struct dquot *dquot, qsize_t number) in dquot_decr_inodes() argument
1121 if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE || in dquot_decr_inodes()
1122 dquot->dq_dqb.dqb_curinodes >= number) in dquot_decr_inodes()
1123 dquot->dq_dqb.dqb_curinodes -= number; in dquot_decr_inodes()
1125 dquot->dq_dqb.dqb_curinodes = 0; in dquot_decr_inodes()
1126 if (dquot->dq_dqb.dqb_curinodes <= dquot->dq_dqb.dqb_isoftlimit) in dquot_decr_inodes()
1127 dquot->dq_dqb.dqb_itime = (time64_t) 0; in dquot_decr_inodes()
1128 clear_bit(DQ_INODES_B, &dquot->dq_flags); in dquot_decr_inodes()
1131 static void dquot_decr_space(struct dquot *dquot, qsize_t number) in dquot_decr_space() argument
1133 if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE || in dquot_decr_space()
1134 dquot->dq_dqb.dqb_curspace >= number) in dquot_decr_space()
1135 dquot->dq_dqb.dqb_curspace -= number; in dquot_decr_space()
1137 dquot->dq_dqb.dqb_curspace = 0; in dquot_decr_space()
1138 if (dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace <= in dquot_decr_space()
1139 dquot->dq_dqb.dqb_bsoftlimit) in dquot_decr_space()
1140 dquot->dq_dqb.dqb_btime = (time64_t) 0; in dquot_decr_space()
1141 clear_bit(DQ_BLKS_B, &dquot->dq_flags); in dquot_decr_space()
1150 static int warning_issued(struct dquot *dquot, const int warntype) in warning_issued() argument
1159 return test_and_set_bit(flag, &dquot->dq_flags); in warning_issued()
1228 static void prepare_warning(struct dquot_warn *warn, struct dquot *dquot, in prepare_warning() argument
1231 if (warning_issued(dquot, warntype)) in prepare_warning()
1234 warn->w_sb = dquot->dq_sb; in prepare_warning()
1235 warn->w_dq_id = dquot->dq_id; in prepare_warning()
1258 static int ignore_hardlimit(struct dquot *dquot) in ignore_hardlimit() argument
1260 struct mem_dqinfo *info = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type]; in ignore_hardlimit()
1267 static int dquot_add_inodes(struct dquot *dquot, qsize_t inodes, in dquot_add_inodes() argument
1273 spin_lock(&dquot->dq_dqb_lock); in dquot_add_inodes()
1274 newinodes = dquot->dq_dqb.dqb_curinodes + inodes; in dquot_add_inodes()
1275 if (!sb_has_quota_limits_enabled(dquot->dq_sb, dquot->dq_id.type) || in dquot_add_inodes()
1276 test_bit(DQ_FAKE_B, &dquot->dq_flags)) in dquot_add_inodes()
1279 if (dquot->dq_dqb.dqb_ihardlimit && in dquot_add_inodes()
1280 newinodes > dquot->dq_dqb.dqb_ihardlimit && in dquot_add_inodes()
1281 !ignore_hardlimit(dquot)) { in dquot_add_inodes()
1282 prepare_warning(warn, dquot, QUOTA_NL_IHARDWARN); in dquot_add_inodes()
1287 if (dquot->dq_dqb.dqb_isoftlimit && in dquot_add_inodes()
1288 newinodes > dquot->dq_dqb.dqb_isoftlimit && in dquot_add_inodes()
1289 dquot->dq_dqb.dqb_itime && in dquot_add_inodes()
1290 ktime_get_real_seconds() >= dquot->dq_dqb.dqb_itime && in dquot_add_inodes()
1291 !ignore_hardlimit(dquot)) { in dquot_add_inodes()
1292 prepare_warning(warn, dquot, QUOTA_NL_ISOFTLONGWARN); in dquot_add_inodes()
1297 if (dquot->dq_dqb.dqb_isoftlimit && in dquot_add_inodes()
1298 newinodes > dquot->dq_dqb.dqb_isoftlimit && in dquot_add_inodes()
1299 dquot->dq_dqb.dqb_itime == 0) { in dquot_add_inodes()
1300 prepare_warning(warn, dquot, QUOTA_NL_ISOFTWARN); in dquot_add_inodes()
1301 dquot->dq_dqb.dqb_itime = ktime_get_real_seconds() + in dquot_add_inodes()
1302 sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type].dqi_igrace; in dquot_add_inodes()
1305 dquot->dq_dqb.dqb_curinodes = newinodes; in dquot_add_inodes()
1308 spin_unlock(&dquot->dq_dqb_lock); in dquot_add_inodes()
1312 static int dquot_add_space(struct dquot *dquot, qsize_t space, in dquot_add_space() argument
1317 struct super_block *sb = dquot->dq_sb; in dquot_add_space()
1320 spin_lock(&dquot->dq_dqb_lock); in dquot_add_space()
1321 if (!sb_has_quota_limits_enabled(sb, dquot->dq_id.type) || in dquot_add_space()
1322 test_bit(DQ_FAKE_B, &dquot->dq_flags)) in dquot_add_space()
1325 tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace in dquot_add_space()
1328 if (dquot->dq_dqb.dqb_bhardlimit && in dquot_add_space()
1329 tspace > dquot->dq_dqb.dqb_bhardlimit && in dquot_add_space()
1330 !ignore_hardlimit(dquot)) { in dquot_add_space()
1332 prepare_warning(warn, dquot, QUOTA_NL_BHARDWARN); in dquot_add_space()
1337 if (dquot->dq_dqb.dqb_bsoftlimit && in dquot_add_space()
1338 tspace > dquot->dq_dqb.dqb_bsoftlimit && in dquot_add_space()
1339 dquot->dq_dqb.dqb_btime && in dquot_add_space()
1340 ktime_get_real_seconds() >= dquot->dq_dqb.dqb_btime && in dquot_add_space()
1341 !ignore_hardlimit(dquot)) { in dquot_add_space()
1343 prepare_warning(warn, dquot, QUOTA_NL_BSOFTLONGWARN); in dquot_add_space()
1348 if (dquot->dq_dqb.dqb_bsoftlimit && in dquot_add_space()
1349 tspace > dquot->dq_dqb.dqb_bsoftlimit && in dquot_add_space()
1350 dquot->dq_dqb.dqb_btime == 0) { in dquot_add_space()
1352 prepare_warning(warn, dquot, QUOTA_NL_BSOFTWARN); in dquot_add_space()
1353 dquot->dq_dqb.dqb_btime = ktime_get_real_seconds() + in dquot_add_space()
1354 sb_dqopt(sb)->info[dquot->dq_id.type].dqi_bgrace; in dquot_add_space()
1373 dquot->dq_dqb.dqb_rsvspace += rsv_space; in dquot_add_space()
1374 dquot->dq_dqb.dqb_curspace += space; in dquot_add_space()
1376 spin_unlock(&dquot->dq_dqb_lock); in dquot_add_space()
1380 static int info_idq_free(struct dquot *dquot, qsize_t inodes) in info_idq_free() argument
1384 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || in info_idq_free()
1385 dquot->dq_dqb.dqb_curinodes <= dquot->dq_dqb.dqb_isoftlimit || in info_idq_free()
1386 !sb_has_quota_limits_enabled(dquot->dq_sb, dquot->dq_id.type)) in info_idq_free()
1389 newinodes = dquot->dq_dqb.dqb_curinodes - inodes; in info_idq_free()
1390 if (newinodes <= dquot->dq_dqb.dqb_isoftlimit) in info_idq_free()
1392 if (dquot->dq_dqb.dqb_curinodes >= dquot->dq_dqb.dqb_ihardlimit && in info_idq_free()
1393 newinodes < dquot->dq_dqb.dqb_ihardlimit) in info_idq_free()
1398 static int info_bdq_free(struct dquot *dquot, qsize_t space) in info_bdq_free() argument
1402 tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace; in info_bdq_free()
1404 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || in info_bdq_free()
1405 tspace <= dquot->dq_dqb.dqb_bsoftlimit) in info_bdq_free()
1408 if (tspace - space <= dquot->dq_dqb.dqb_bsoftlimit) in info_bdq_free()
1410 if (tspace >= dquot->dq_dqb.dqb_bhardlimit && in info_bdq_free()
1411 tspace - space < dquot->dq_dqb.dqb_bhardlimit) in info_bdq_free()
1434 struct dquot **dquots, *got[MAXQUOTAS] = {}; in __dquot_initialize()
1449 struct dquot *dquot; in __dquot_initialize() local
1480 dquot = dqget(sb, qid); in __dquot_initialize()
1481 if (IS_ERR(dquot)) { in __dquot_initialize()
1483 if (PTR_ERR(dquot) != -ESRCH) { in __dquot_initialize()
1484 ret = PTR_ERR(dquot); in __dquot_initialize()
1487 dquot = NULL; in __dquot_initialize()
1489 got[cnt] = dquot; in __dquot_initialize()
1544 struct dquot **dquots; in dquot_initialize_needed()
1569 struct dquot **dquots = i_dquot(inode); in __dquot_drop()
1570 struct dquot *put[MAXQUOTAS]; in __dquot_drop()
1583 struct dquot * const *dquots; in dquot_drop()
1656 struct dquot **dquots; in __dquot_alloc_space()
1726 struct dquot * const *dquots; in dquot_alloc_inode()
1768 struct dquot **dquots; in dquot_claim_space_nodirty()
1785 struct dquot *dquot = dquots[cnt]; in dquot_claim_space_nodirty() local
1787 spin_lock(&dquot->dq_dqb_lock); in dquot_claim_space_nodirty()
1788 if (WARN_ON_ONCE(dquot->dq_dqb.dqb_rsvspace < number)) in dquot_claim_space_nodirty()
1789 number = dquot->dq_dqb.dqb_rsvspace; in dquot_claim_space_nodirty()
1790 dquot->dq_dqb.dqb_curspace += number; in dquot_claim_space_nodirty()
1791 dquot->dq_dqb.dqb_rsvspace -= number; in dquot_claim_space_nodirty()
1792 spin_unlock(&dquot->dq_dqb_lock); in dquot_claim_space_nodirty()
1810 struct dquot **dquots; in dquot_reclaim_space_nodirty()
1827 struct dquot *dquot = dquots[cnt]; in dquot_reclaim_space_nodirty() local
1829 spin_lock(&dquot->dq_dqb_lock); in dquot_reclaim_space_nodirty()
1830 if (WARN_ON_ONCE(dquot->dq_dqb.dqb_curspace < number)) in dquot_reclaim_space_nodirty()
1831 number = dquot->dq_dqb.dqb_curspace; in dquot_reclaim_space_nodirty()
1832 dquot->dq_dqb.dqb_rsvspace += number; in dquot_reclaim_space_nodirty()
1833 dquot->dq_dqb.dqb_curspace -= number; in dquot_reclaim_space_nodirty()
1834 spin_unlock(&dquot->dq_dqb_lock); in dquot_reclaim_space_nodirty()
1854 struct dquot **dquots; in __dquot_free_space()
1909 struct dquot * const *dquots; in dquot_free_inode()
1950 int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) in __dquot_transfer()
1955 struct dquot *transfer_from[MAXQUOTAS] = {}; in __dquot_transfer()
2078 struct dquot *transfer_to[MAXQUOTAS] = {}; in dquot_transfer()
2079 struct dquot *dquot; in dquot_transfer() local
2087 dquot = dqget(sb, make_kqid_uid(iattr->ia_uid)); in dquot_transfer()
2088 if (IS_ERR(dquot)) { in dquot_transfer()
2089 if (PTR_ERR(dquot) != -ESRCH) { in dquot_transfer()
2090 ret = PTR_ERR(dquot); in dquot_transfer()
2093 dquot = NULL; in dquot_transfer()
2095 transfer_to[USRQUOTA] = dquot; in dquot_transfer()
2098 dquot = dqget(sb, make_kqid_gid(iattr->ia_gid)); in dquot_transfer()
2099 if (IS_ERR(dquot)) { in dquot_transfer()
2100 if (PTR_ERR(dquot) != -ESRCH) { in dquot_transfer()
2101 ret = PTR_ERR(dquot); in dquot_transfer()
2104 dquot = NULL; in dquot_transfer()
2106 transfer_to[GRPQUOTA] = dquot; in dquot_transfer()
2613 static void do_get_dqblk(struct dquot *dquot, struct qc_dqblk *di) in do_get_dqblk() argument
2615 struct mem_dqblk *dm = &dquot->dq_dqb; in do_get_dqblk()
2618 spin_lock(&dquot->dq_dqb_lock); in do_get_dqblk()
2627 spin_unlock(&dquot->dq_dqb_lock); in do_get_dqblk()
2633 struct dquot *dquot; in dquot_get_dqblk() local
2635 dquot = dqget(sb, qid); in dquot_get_dqblk()
2636 if (IS_ERR(dquot)) in dquot_get_dqblk()
2637 return PTR_ERR(dquot); in dquot_get_dqblk()
2638 do_get_dqblk(dquot, di); in dquot_get_dqblk()
2639 dqput(dquot); in dquot_get_dqblk()
2648 struct dquot *dquot; in dquot_get_next_dqblk() local
2656 dquot = dqget(sb, *qid); in dquot_get_next_dqblk()
2657 if (IS_ERR(dquot)) in dquot_get_next_dqblk()
2658 return PTR_ERR(dquot); in dquot_get_next_dqblk()
2659 do_get_dqblk(dquot, di); in dquot_get_next_dqblk()
2660 dqput(dquot); in dquot_get_next_dqblk()
2672 static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di) in do_set_dqblk() argument
2674 struct mem_dqblk *dm = &dquot->dq_dqb; in do_set_dqblk()
2676 struct mem_dqinfo *dqi = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type]; in do_set_dqblk()
2691 spin_lock(&dquot->dq_dqb_lock); in do_set_dqblk()
2695 set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags); in do_set_dqblk()
2704 set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags); in do_set_dqblk()
2710 set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags); in do_set_dqblk()
2719 set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags); in do_set_dqblk()
2725 set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); in do_set_dqblk()
2731 set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); in do_set_dqblk()
2738 clear_bit(DQ_BLKS_B, &dquot->dq_flags); in do_set_dqblk()
2747 clear_bit(DQ_INODES_B, &dquot->dq_flags); in do_set_dqblk()
2754 clear_bit(DQ_FAKE_B, &dquot->dq_flags); in do_set_dqblk()
2756 set_bit(DQ_FAKE_B, &dquot->dq_flags); in do_set_dqblk()
2757 spin_unlock(&dquot->dq_dqb_lock); in do_set_dqblk()
2758 mark_dquot_dirty(dquot); in do_set_dqblk()
2766 struct dquot *dquot; in dquot_set_dqblk() local
2769 dquot = dqget(sb, qid); in dquot_set_dqblk()
2770 if (IS_ERR(dquot)) { in dquot_set_dqblk()
2771 rc = PTR_ERR(dquot); in dquot_set_dqblk()
2774 rc = do_set_dqblk(dquot, di); in dquot_set_dqblk()
2775 dqput(dquot); in dquot_set_dqblk()
2975 sizeof(struct dquot), sizeof(unsigned long) * 4, in dquot_init()