Lines Matching refs:dquot
277 static inline void insert_dquot_hash(struct dquot *dquot) in insert_dquot_hash() argument
280 head = dquot_hash + hashfn(dquot->dq_sb, dquot->dq_id); in insert_dquot_hash()
281 hlist_add_head(&dquot->dq_hash, head); in insert_dquot_hash()
284 static inline void remove_dquot_hash(struct dquot *dquot) in remove_dquot_hash() argument
286 hlist_del_init(&dquot->dq_hash); in remove_dquot_hash()
289 static struct dquot *find_dquot(unsigned int hashent, struct super_block *sb, in find_dquot()
292 struct dquot *dquot; in find_dquot() local
294 hlist_for_each_entry(dquot, dquot_hash+hashent, 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
430 struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); in dquot_acquire()
432 mutex_lock(&dquot->dq_lock); in dquot_acquire()
434 if (!test_bit(DQ_READ_B, &dquot->dq_flags)) { in dquot_acquire()
435 ret = dqopt->ops[dquot->dq_id.type]->read_dqblk(dquot); in dquot_acquire()
441 set_bit(DQ_READ_B, &dquot->dq_flags); in dquot_acquire()
443 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && !dquot->dq_off) { in dquot_acquire()
444 ret = dqopt->ops[dquot->dq_id.type]->commit_dqblk(dquot); in dquot_acquire()
446 if (info_dirty(&dqopt->info[dquot->dq_id.type])) { in dquot_acquire()
447 ret2 = dqopt->ops[dquot->dq_id.type]->write_file_info( in dquot_acquire()
448 dquot->dq_sb, dquot->dq_id.type); in dquot_acquire()
462 set_bit(DQ_ACTIVE_B, &dquot->dq_flags); in dquot_acquire()
465 mutex_unlock(&dquot->dq_lock); in dquot_acquire()
473 int dquot_commit(struct dquot *dquot) in dquot_commit() argument
477 struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); in dquot_commit()
479 mutex_lock(&dquot->dq_lock); in dquot_commit()
481 if (!clear_dquot_dirty(dquot)) in dquot_commit()
485 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) in dquot_commit()
486 ret = dqopt->ops[dquot->dq_id.type]->commit_dqblk(dquot); in dquot_commit()
491 mutex_unlock(&dquot->dq_lock); in dquot_commit()
499 int dquot_release(struct dquot *dquot) in dquot_release() argument
503 struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); in dquot_release()
505 mutex_lock(&dquot->dq_lock); in dquot_release()
508 if (dquot_is_busy(dquot)) in dquot_release()
510 if (dqopt->ops[dquot->dq_id.type]->release_dqblk) { in dquot_release()
511 ret = dqopt->ops[dquot->dq_id.type]->release_dqblk(dquot); in dquot_release()
513 if (info_dirty(&dqopt->info[dquot->dq_id.type])) { in dquot_release()
514 ret2 = dqopt->ops[dquot->dq_id.type]->write_file_info( in dquot_release()
515 dquot->dq_sb, dquot->dq_id.type); in dquot_release()
520 clear_bit(DQ_ACTIVE_B, &dquot->dq_flags); in dquot_release()
523 mutex_unlock(&dquot->dq_lock); in dquot_release()
528 void dquot_destroy(struct dquot *dquot) in dquot_destroy() argument
530 kmem_cache_free(dquot_cachep, dquot); in dquot_destroy()
534 static inline void do_destroy_dquot(struct dquot *dquot) in do_destroy_dquot() argument
536 dquot->dq_sb->dq_op->destroy_dquot(dquot); in do_destroy_dquot()
547 struct dquot *dquot, *tmp; in invalidate_dquots() local
551 list_for_each_entry_safe(dquot, tmp, &inuse_list, dq_inuse) { in invalidate_dquots()
552 if (dquot->dq_sb != sb) in invalidate_dquots()
554 if (dquot->dq_id.type != type) in invalidate_dquots()
557 if (atomic_read(&dquot->dq_count)) { in invalidate_dquots()
558 dqgrab(dquot); in invalidate_dquots()
569 atomic_read(&dquot->dq_count) == 1); in invalidate_dquots()
570 dqput(dquot); in invalidate_dquots()
580 remove_dquot_hash(dquot); in invalidate_dquots()
581 remove_free_dquot(dquot); in invalidate_dquots()
582 remove_inuse(dquot); in invalidate_dquots()
583 do_destroy_dquot(dquot); in invalidate_dquots()
590 int (*fn)(struct dquot *dquot, unsigned long priv), in dquot_scan_active() argument
593 struct dquot *dquot, *old_dquot = NULL; in dquot_scan_active() local
599 list_for_each_entry(dquot, &inuse_list, dq_inuse) { in dquot_scan_active()
600 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) in dquot_scan_active()
602 if (dquot->dq_sb != sb) in dquot_scan_active()
605 atomic_inc(&dquot->dq_count); in dquot_scan_active()
608 old_dquot = dquot; in dquot_scan_active()
614 wait_on_dquot(dquot); in dquot_scan_active()
615 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { in dquot_scan_active()
616 ret = fn(dquot, priv); in dquot_scan_active()
635 struct dquot *dquot; in dquot_writeback_dquots() local
651 dquot = list_first_entry(&dirty, struct dquot, in dquot_writeback_dquots()
654 WARN_ON(!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)); in dquot_writeback_dquots()
659 dqgrab(dquot); in dquot_writeback_dquots()
661 err = sb->dq_op->write_dquot(dquot); in dquot_writeback_dquots()
667 clear_dquot_dirty(dquot); in dquot_writeback_dquots()
671 dqput(dquot); in dquot_writeback_dquots()
733 struct dquot *dquot; in dqcache_shrink_scan() local
738 dquot = list_first_entry(&free_dquots, struct dquot, dq_free); in dqcache_shrink_scan()
739 remove_dquot_hash(dquot); in dqcache_shrink_scan()
740 remove_free_dquot(dquot); in dqcache_shrink_scan()
741 remove_inuse(dquot); in dqcache_shrink_scan()
742 do_destroy_dquot(dquot); in dqcache_shrink_scan()
766 void dqput(struct dquot *dquot) in dqput() argument
770 if (!dquot) in dqput()
773 if (!atomic_read(&dquot->dq_count)) { in dqput()
774 quota_error(dquot->dq_sb, "trying to free free dquot of %s %d", in dqput()
775 quotatypes[dquot->dq_id.type], in dqput()
776 from_kqid(&init_user_ns, dquot->dq_id)); in dqput()
783 if (atomic_read(&dquot->dq_count) > 1) { in dqput()
785 atomic_dec(&dquot->dq_count); in dqput()
787 if (!sb_has_quota_active(dquot->dq_sb, dquot->dq_id.type) && in dqput()
788 atomic_read(&dquot->dq_count) == 1) in dqput()
794 if (dquot_dirty(dquot)) { in dqput()
797 ret = dquot->dq_sb->dq_op->write_dquot(dquot); in dqput()
799 quota_error(dquot->dq_sb, "Can't write quota structure" in dqput()
806 clear_dquot_dirty(dquot); in dqput()
810 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { in dqput()
812 dquot->dq_sb->dq_op->release_dquot(dquot); in dqput()
815 atomic_dec(&dquot->dq_count); in dqput()
818 BUG_ON(!list_empty(&dquot->dq_free)); in dqput()
820 put_dquot_last(dquot); in dqput()
825 struct dquot *dquot_alloc(struct super_block *sb, int type) in dquot_alloc()
831 static struct dquot *get_empty_dquot(struct super_block *sb, int type) in get_empty_dquot()
833 struct dquot *dquot; in get_empty_dquot() local
835 dquot = sb->dq_op->alloc_dquot(sb, type); in get_empty_dquot()
836 if(!dquot) in get_empty_dquot()
839 mutex_init(&dquot->dq_lock); in get_empty_dquot()
840 INIT_LIST_HEAD(&dquot->dq_free); in get_empty_dquot()
841 INIT_LIST_HEAD(&dquot->dq_inuse); in get_empty_dquot()
842 INIT_HLIST_NODE(&dquot->dq_hash); in get_empty_dquot()
843 INIT_LIST_HEAD(&dquot->dq_dirty); in get_empty_dquot()
844 dquot->dq_sb = sb; in get_empty_dquot()
845 dquot->dq_id = make_kqid_invalid(type); in get_empty_dquot()
846 atomic_set(&dquot->dq_count, 1); in get_empty_dquot()
847 spin_lock_init(&dquot->dq_dqb_lock); in get_empty_dquot()
849 return dquot; in get_empty_dquot()
860 struct dquot *dqget(struct super_block *sb, struct kqid qid) in dqget()
863 struct dquot *dquot, *empty = NULL; in dqget() local
876 dquot = ERR_PTR(-ESRCH); in dqget()
881 dquot = find_dquot(hashent, sb, qid); in dqget()
882 if (!dquot) { in dqget()
890 dquot = empty; in dqget()
892 dquot->dq_id = qid; in dqget()
894 put_inuse(dquot); in dqget()
896 insert_dquot_hash(dquot); in dqget()
900 if (!atomic_read(&dquot->dq_count)) in dqget()
901 remove_free_dquot(dquot); in dqget()
902 atomic_inc(&dquot->dq_count); in dqget()
909 wait_on_dquot(dquot); in dqget()
911 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { in dqget()
914 err = sb->dq_op->acquire_dquot(dquot); in dqget()
916 dqput(dquot); in dqget()
917 dquot = ERR_PTR(err); in dqget()
927 BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */ in dqget()
933 return dquot; in dqget()
937 static inline struct dquot **i_dquot(struct inode *inode) in i_dquot()
944 struct dquot * const *dquots; in dqinit_needed()
1024 struct dquot **dquots = i_dquot(inode); in remove_inode_dquot_ref()
1025 struct dquot *dquot = dquots[type]; in remove_inode_dquot_ref() local
1027 if (!dquot) in remove_inode_dquot_ref()
1031 if (list_empty(&dquot->dq_free)) { in remove_inode_dquot_ref()
1037 list_add(&dquot->dq_free, tofree_head); in remove_inode_dquot_ref()
1044 dqput(dquot); in remove_inode_dquot_ref()
1056 struct dquot *dquot; in put_dquot_list() local
1060 dquot = list_entry(act_head, struct dquot, dq_free); in put_dquot_list()
1063 list_del_init(&dquot->dq_free); in put_dquot_list()
1064 dqput(dquot); in put_dquot_list()
1117 void dquot_free_reserved_space(struct dquot *dquot, qsize_t number) in dquot_free_reserved_space() argument
1119 if (dquot->dq_dqb.dqb_rsvspace >= number) in dquot_free_reserved_space()
1120 dquot->dq_dqb.dqb_rsvspace -= number; in dquot_free_reserved_space()
1123 dquot->dq_dqb.dqb_rsvspace = 0; in dquot_free_reserved_space()
1125 if (dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace <= in dquot_free_reserved_space()
1126 dquot->dq_dqb.dqb_bsoftlimit) in dquot_free_reserved_space()
1127 dquot->dq_dqb.dqb_btime = (time64_t) 0; in dquot_free_reserved_space()
1128 clear_bit(DQ_BLKS_B, &dquot->dq_flags); in dquot_free_reserved_space()
1131 static void dquot_decr_inodes(struct dquot *dquot, qsize_t number) in dquot_decr_inodes() argument
1133 if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE || in dquot_decr_inodes()
1134 dquot->dq_dqb.dqb_curinodes >= number) in dquot_decr_inodes()
1135 dquot->dq_dqb.dqb_curinodes -= number; in dquot_decr_inodes()
1137 dquot->dq_dqb.dqb_curinodes = 0; in dquot_decr_inodes()
1138 if (dquot->dq_dqb.dqb_curinodes <= dquot->dq_dqb.dqb_isoftlimit) in dquot_decr_inodes()
1139 dquot->dq_dqb.dqb_itime = (time64_t) 0; in dquot_decr_inodes()
1140 clear_bit(DQ_INODES_B, &dquot->dq_flags); in dquot_decr_inodes()
1143 static void dquot_decr_space(struct dquot *dquot, qsize_t number) in dquot_decr_space() argument
1145 if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE || in dquot_decr_space()
1146 dquot->dq_dqb.dqb_curspace >= number) in dquot_decr_space()
1147 dquot->dq_dqb.dqb_curspace -= number; in dquot_decr_space()
1149 dquot->dq_dqb.dqb_curspace = 0; in dquot_decr_space()
1150 if (dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace <= in dquot_decr_space()
1151 dquot->dq_dqb.dqb_bsoftlimit) in dquot_decr_space()
1152 dquot->dq_dqb.dqb_btime = (time64_t) 0; in dquot_decr_space()
1153 clear_bit(DQ_BLKS_B, &dquot->dq_flags); in dquot_decr_space()
1162 static int warning_issued(struct dquot *dquot, const int warntype) in warning_issued() argument
1171 return test_and_set_bit(flag, &dquot->dq_flags); in warning_issued()
1240 static void prepare_warning(struct dquot_warn *warn, struct dquot *dquot, in prepare_warning() argument
1243 if (warning_issued(dquot, warntype)) in prepare_warning()
1246 warn->w_sb = dquot->dq_sb; in prepare_warning()
1247 warn->w_dq_id = dquot->dq_id; in prepare_warning()
1270 static int ignore_hardlimit(struct dquot *dquot) in ignore_hardlimit() argument
1272 struct mem_dqinfo *info = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type]; in ignore_hardlimit()
1279 static int dquot_add_inodes(struct dquot *dquot, qsize_t inodes, in dquot_add_inodes() argument
1285 spin_lock(&dquot->dq_dqb_lock); in dquot_add_inodes()
1286 newinodes = dquot->dq_dqb.dqb_curinodes + inodes; in dquot_add_inodes()
1287 if (!sb_has_quota_limits_enabled(dquot->dq_sb, dquot->dq_id.type) || in dquot_add_inodes()
1288 test_bit(DQ_FAKE_B, &dquot->dq_flags)) in dquot_add_inodes()
1291 if (dquot->dq_dqb.dqb_ihardlimit && in dquot_add_inodes()
1292 newinodes > dquot->dq_dqb.dqb_ihardlimit && in dquot_add_inodes()
1293 !ignore_hardlimit(dquot)) { in dquot_add_inodes()
1294 prepare_warning(warn, dquot, QUOTA_NL_IHARDWARN); in dquot_add_inodes()
1299 if (dquot->dq_dqb.dqb_isoftlimit && in dquot_add_inodes()
1300 newinodes > dquot->dq_dqb.dqb_isoftlimit && in dquot_add_inodes()
1301 dquot->dq_dqb.dqb_itime && in dquot_add_inodes()
1302 ktime_get_real_seconds() >= dquot->dq_dqb.dqb_itime && in dquot_add_inodes()
1303 !ignore_hardlimit(dquot)) { in dquot_add_inodes()
1304 prepare_warning(warn, dquot, QUOTA_NL_ISOFTLONGWARN); in dquot_add_inodes()
1309 if (dquot->dq_dqb.dqb_isoftlimit && in dquot_add_inodes()
1310 newinodes > dquot->dq_dqb.dqb_isoftlimit && in dquot_add_inodes()
1311 dquot->dq_dqb.dqb_itime == 0) { in dquot_add_inodes()
1312 prepare_warning(warn, dquot, QUOTA_NL_ISOFTWARN); in dquot_add_inodes()
1313 dquot->dq_dqb.dqb_itime = ktime_get_real_seconds() + in dquot_add_inodes()
1314 sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type].dqi_igrace; in dquot_add_inodes()
1317 dquot->dq_dqb.dqb_curinodes = newinodes; in dquot_add_inodes()
1320 spin_unlock(&dquot->dq_dqb_lock); in dquot_add_inodes()
1324 static int dquot_add_space(struct dquot *dquot, qsize_t space, in dquot_add_space() argument
1329 struct super_block *sb = dquot->dq_sb; in dquot_add_space()
1332 spin_lock(&dquot->dq_dqb_lock); in dquot_add_space()
1333 if (!sb_has_quota_limits_enabled(sb, dquot->dq_id.type) || in dquot_add_space()
1334 test_bit(DQ_FAKE_B, &dquot->dq_flags)) in dquot_add_space()
1337 tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace in dquot_add_space()
1340 if (dquot->dq_dqb.dqb_bhardlimit && in dquot_add_space()
1341 tspace > dquot->dq_dqb.dqb_bhardlimit && in dquot_add_space()
1342 !ignore_hardlimit(dquot)) { in dquot_add_space()
1344 prepare_warning(warn, dquot, QUOTA_NL_BHARDWARN); in dquot_add_space()
1349 if (dquot->dq_dqb.dqb_bsoftlimit && in dquot_add_space()
1350 tspace > dquot->dq_dqb.dqb_bsoftlimit && in dquot_add_space()
1351 dquot->dq_dqb.dqb_btime && in dquot_add_space()
1352 ktime_get_real_seconds() >= dquot->dq_dqb.dqb_btime && in dquot_add_space()
1353 !ignore_hardlimit(dquot)) { in dquot_add_space()
1355 prepare_warning(warn, dquot, QUOTA_NL_BSOFTLONGWARN); in dquot_add_space()
1360 if (dquot->dq_dqb.dqb_bsoftlimit && in dquot_add_space()
1361 tspace > dquot->dq_dqb.dqb_bsoftlimit && in dquot_add_space()
1362 dquot->dq_dqb.dqb_btime == 0) { in dquot_add_space()
1364 prepare_warning(warn, dquot, QUOTA_NL_BSOFTWARN); in dquot_add_space()
1365 dquot->dq_dqb.dqb_btime = ktime_get_real_seconds() + in dquot_add_space()
1366 sb_dqopt(sb)->info[dquot->dq_id.type].dqi_bgrace; in dquot_add_space()
1385 dquot->dq_dqb.dqb_rsvspace += rsv_space; in dquot_add_space()
1386 dquot->dq_dqb.dqb_curspace += space; in dquot_add_space()
1388 spin_unlock(&dquot->dq_dqb_lock); in dquot_add_space()
1392 static int info_idq_free(struct dquot *dquot, qsize_t inodes) in info_idq_free() argument
1396 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || in info_idq_free()
1397 dquot->dq_dqb.dqb_curinodes <= dquot->dq_dqb.dqb_isoftlimit || in info_idq_free()
1398 !sb_has_quota_limits_enabled(dquot->dq_sb, dquot->dq_id.type)) in info_idq_free()
1401 newinodes = dquot->dq_dqb.dqb_curinodes - inodes; in info_idq_free()
1402 if (newinodes <= dquot->dq_dqb.dqb_isoftlimit) in info_idq_free()
1404 if (dquot->dq_dqb.dqb_curinodes >= dquot->dq_dqb.dqb_ihardlimit && in info_idq_free()
1405 newinodes < dquot->dq_dqb.dqb_ihardlimit) in info_idq_free()
1410 static int info_bdq_free(struct dquot *dquot, qsize_t space) in info_bdq_free() argument
1414 tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace; in info_bdq_free()
1416 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || in info_bdq_free()
1417 tspace <= dquot->dq_dqb.dqb_bsoftlimit) in info_bdq_free()
1420 if (tspace - space <= dquot->dq_dqb.dqb_bsoftlimit) in info_bdq_free()
1422 if (tspace >= dquot->dq_dqb.dqb_bhardlimit && in info_bdq_free()
1423 tspace - space < dquot->dq_dqb.dqb_bhardlimit) in info_bdq_free()
1446 struct dquot **dquots, *got[MAXQUOTAS] = {}; in __dquot_initialize()
1461 struct dquot *dquot; in __dquot_initialize() local
1492 dquot = dqget(sb, qid); in __dquot_initialize()
1493 if (IS_ERR(dquot)) { in __dquot_initialize()
1495 if (PTR_ERR(dquot) != -ESRCH) { in __dquot_initialize()
1496 ret = PTR_ERR(dquot); in __dquot_initialize()
1499 dquot = NULL; in __dquot_initialize()
1501 got[cnt] = dquot; in __dquot_initialize()
1556 struct dquot **dquots; in dquot_initialize_needed()
1581 struct dquot **dquots = i_dquot(inode); in __dquot_drop()
1582 struct dquot *put[MAXQUOTAS]; in __dquot_drop()
1595 struct dquot * const *dquots; in dquot_drop()
1668 struct dquot **dquots; in __dquot_alloc_space()
1738 struct dquot * const *dquots; in dquot_alloc_inode()
1780 struct dquot **dquots; in dquot_claim_space_nodirty()
1797 struct dquot *dquot = dquots[cnt]; in dquot_claim_space_nodirty() local
1799 spin_lock(&dquot->dq_dqb_lock); in dquot_claim_space_nodirty()
1800 if (WARN_ON_ONCE(dquot->dq_dqb.dqb_rsvspace < number)) in dquot_claim_space_nodirty()
1801 number = dquot->dq_dqb.dqb_rsvspace; in dquot_claim_space_nodirty()
1802 dquot->dq_dqb.dqb_curspace += number; in dquot_claim_space_nodirty()
1803 dquot->dq_dqb.dqb_rsvspace -= number; in dquot_claim_space_nodirty()
1804 spin_unlock(&dquot->dq_dqb_lock); in dquot_claim_space_nodirty()
1822 struct dquot **dquots; in dquot_reclaim_space_nodirty()
1839 struct dquot *dquot = dquots[cnt]; in dquot_reclaim_space_nodirty() local
1841 spin_lock(&dquot->dq_dqb_lock); in dquot_reclaim_space_nodirty()
1842 if (WARN_ON_ONCE(dquot->dq_dqb.dqb_curspace < number)) in dquot_reclaim_space_nodirty()
1843 number = dquot->dq_dqb.dqb_curspace; in dquot_reclaim_space_nodirty()
1844 dquot->dq_dqb.dqb_rsvspace += number; in dquot_reclaim_space_nodirty()
1845 dquot->dq_dqb.dqb_curspace -= number; in dquot_reclaim_space_nodirty()
1846 spin_unlock(&dquot->dq_dqb_lock); in dquot_reclaim_space_nodirty()
1866 struct dquot **dquots; in __dquot_free_space()
1921 struct dquot * const *dquots; in dquot_free_inode()
1962 int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) in __dquot_transfer()
1967 struct dquot *transfer_from[MAXQUOTAS] = {}; in __dquot_transfer()
2091 struct dquot *transfer_to[MAXQUOTAS] = {}; in dquot_transfer()
2092 struct dquot *dquot; in dquot_transfer() local
2103 dquot = dqget(sb, make_kqid_uid(kuid)); in dquot_transfer()
2104 if (IS_ERR(dquot)) { in dquot_transfer()
2105 if (PTR_ERR(dquot) != -ESRCH) { in dquot_transfer()
2106 ret = PTR_ERR(dquot); in dquot_transfer()
2109 dquot = NULL; in dquot_transfer()
2111 transfer_to[USRQUOTA] = dquot; in dquot_transfer()
2117 dquot = dqget(sb, make_kqid_gid(kgid)); in dquot_transfer()
2118 if (IS_ERR(dquot)) { in dquot_transfer()
2119 if (PTR_ERR(dquot) != -ESRCH) { in dquot_transfer()
2120 ret = PTR_ERR(dquot); in dquot_transfer()
2123 dquot = NULL; in dquot_transfer()
2125 transfer_to[GRPQUOTA] = dquot; in dquot_transfer()
2615 static void do_get_dqblk(struct dquot *dquot, struct qc_dqblk *di) in do_get_dqblk() argument
2617 struct mem_dqblk *dm = &dquot->dq_dqb; in do_get_dqblk()
2620 spin_lock(&dquot->dq_dqb_lock); in do_get_dqblk()
2629 spin_unlock(&dquot->dq_dqb_lock); in do_get_dqblk()
2635 struct dquot *dquot; in dquot_get_dqblk() local
2637 dquot = dqget(sb, qid); in dquot_get_dqblk()
2638 if (IS_ERR(dquot)) in dquot_get_dqblk()
2639 return PTR_ERR(dquot); in dquot_get_dqblk()
2640 do_get_dqblk(dquot, di); in dquot_get_dqblk()
2641 dqput(dquot); in dquot_get_dqblk()
2650 struct dquot *dquot; in dquot_get_next_dqblk() local
2658 dquot = dqget(sb, *qid); in dquot_get_next_dqblk()
2659 if (IS_ERR(dquot)) in dquot_get_next_dqblk()
2660 return PTR_ERR(dquot); in dquot_get_next_dqblk()
2661 do_get_dqblk(dquot, di); in dquot_get_next_dqblk()
2662 dqput(dquot); in dquot_get_next_dqblk()
2674 static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di) in do_set_dqblk() argument
2676 struct mem_dqblk *dm = &dquot->dq_dqb; in do_set_dqblk()
2678 struct mem_dqinfo *dqi = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type]; in do_set_dqblk()
2693 spin_lock(&dquot->dq_dqb_lock); in do_set_dqblk()
2697 set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags); in do_set_dqblk()
2706 set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags); in do_set_dqblk()
2712 set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags); in do_set_dqblk()
2721 set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags); in do_set_dqblk()
2727 set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); in do_set_dqblk()
2733 set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); in do_set_dqblk()
2740 clear_bit(DQ_BLKS_B, &dquot->dq_flags); in do_set_dqblk()
2749 clear_bit(DQ_INODES_B, &dquot->dq_flags); in do_set_dqblk()
2756 clear_bit(DQ_FAKE_B, &dquot->dq_flags); in do_set_dqblk()
2758 set_bit(DQ_FAKE_B, &dquot->dq_flags); in do_set_dqblk()
2759 spin_unlock(&dquot->dq_dqb_lock); in do_set_dqblk()
2760 mark_dquot_dirty(dquot); in do_set_dqblk()
2768 struct dquot *dquot; in dquot_set_dqblk() local
2771 dquot = dqget(sb, qid); in dquot_set_dqblk()
2772 if (IS_ERR(dquot)) { in dquot_set_dqblk()
2773 rc = PTR_ERR(dquot); in dquot_set_dqblk()
2776 rc = do_set_dqblk(dquot, di); in dquot_set_dqblk()
2777 dqput(dquot); in dquot_set_dqblk()
2979 sizeof(struct dquot), sizeof(unsigned long) * 4, in dquot_init()