dquot.c (6988f20fe04e9ef3aea488cb8ab57fbeb78e12f0) | dquot.c (1495f230fa7750479c79e3656286b9183d662077) |
---|---|
1/* 2 * Implementation of the diskquota system for the LINUX operating system. QUOTA 3 * is implemented using the BSD system call interface as the means of 4 * communication with the user level. This file contains the generic routines 5 * called by the different filesystems on allocation of an inode or block. 6 * These routines take care of the administration needed to have a consistent 7 * diskquota tracking system. The ideas of both user and group quotas are based 8 * on the Melbourne quota system as used on BSD derived systems. The internal --- 428 unchanged lines hidden (view full) --- 437} 438EXPORT_SYMBOL(dquot_acquire); 439 440/* 441 * Write dquot to disk 442 */ 443int dquot_commit(struct dquot *dquot) 444{ | 1/* 2 * Implementation of the diskquota system for the LINUX operating system. QUOTA 3 * is implemented using the BSD system call interface as the means of 4 * communication with the user level. This file contains the generic routines 5 * called by the different filesystems on allocation of an inode or block. 6 * These routines take care of the administration needed to have a consistent 7 * diskquota tracking system. The ideas of both user and group quotas are based 8 * on the Melbourne quota system as used on BSD derived systems. The internal --- 428 unchanged lines hidden (view full) --- 437} 438EXPORT_SYMBOL(dquot_acquire); 439 440/* 441 * Write dquot to disk 442 */ 443int dquot_commit(struct dquot *dquot) 444{ |
445 int ret = 0, ret2 = 0; | 445 int ret = 0; |
446 struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); 447 448 mutex_lock(&dqopt->dqio_mutex); 449 spin_lock(&dq_list_lock); 450 if (!clear_dquot_dirty(dquot)) { 451 spin_unlock(&dq_list_lock); 452 goto out_sem; 453 } 454 spin_unlock(&dq_list_lock); 455 /* Inactive dquot can be only if there was error during read/init 456 * => we have better not writing it */ | 446 struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); 447 448 mutex_lock(&dqopt->dqio_mutex); 449 spin_lock(&dq_list_lock); 450 if (!clear_dquot_dirty(dquot)) { 451 spin_unlock(&dq_list_lock); 452 goto out_sem; 453 } 454 spin_unlock(&dq_list_lock); 455 /* Inactive dquot can be only if there was error during read/init 456 * => we have better not writing it */ |
457 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { | 457 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) |
458 ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot); | 458 ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot); |
459 if (info_dirty(&dqopt->info[dquot->dq_type])) { 460 ret2 = dqopt->ops[dquot->dq_type]->write_file_info( 461 dquot->dq_sb, dquot->dq_type); 462 } 463 if (ret >= 0) 464 ret = ret2; 465 } | 459 else 460 ret = -EIO; |
466out_sem: 467 mutex_unlock(&dqopt->dqio_mutex); 468 return ret; 469} 470EXPORT_SYMBOL(dquot_commit); 471 472/* 473 * Release dquot --- 217 unchanged lines hidden (view full) --- 691 head = free_dquots.prev; 692 } 693} 694 695/* 696 * This is called from kswapd when we think we need some 697 * more memory 698 */ | 461out_sem: 462 mutex_unlock(&dqopt->dqio_mutex); 463 return ret; 464} 465EXPORT_SYMBOL(dquot_commit); 466 467/* 468 * Release dquot --- 217 unchanged lines hidden (view full) --- 686 head = free_dquots.prev; 687 } 688} 689 690/* 691 * This is called from kswapd when we think we need some 692 * more memory 693 */ |
699static int shrink_dqcache_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask) | 694static int shrink_dqcache_memory(struct shrinker *shrink, 695 struct shrink_control *sc) |
700{ | 696{ |
697 int nr = sc->nr_to_scan; 698 |
|
701 if (nr) { 702 spin_lock(&dq_list_lock); 703 prune_dqcache(nr); 704 spin_unlock(&dq_list_lock); 705 } 706 return ((unsigned) 707 percpu_counter_read_positive(&dqstats.counter[DQST_FREE_DQUOTS]) 708 /100) * sysctl_vfs_cache_pressure; --- 242 unchanged lines hidden (view full) --- 951{ 952 if (atomic_read(&dquot->dq_count) <= 1) 953 return 1; 954 return 0; 955} 956 957/* 958 * Remove references to dquots from inode and add dquot to list for freeing | 699 if (nr) { 700 spin_lock(&dq_list_lock); 701 prune_dqcache(nr); 702 spin_unlock(&dq_list_lock); 703 } 704 return ((unsigned) 705 percpu_counter_read_positive(&dqstats.counter[DQST_FREE_DQUOTS]) 706 /100) * sysctl_vfs_cache_pressure; --- 242 unchanged lines hidden (view full) --- 949{ 950 if (atomic_read(&dquot->dq_count) <= 1) 951 return 1; 952 return 0; 953} 954 955/* 956 * Remove references to dquots from inode and add dquot to list for freeing |
959 * if we have the last referece to dquot | 957 * if we have the last reference to dquot |
960 * We can't race with anybody because we hold dqptr_sem for writing... 961 */ 962static int remove_inode_dquot_ref(struct inode *inode, int type, 963 struct list_head *tofree_head) 964{ 965 struct dquot *dquot = inode->i_dquot[type]; 966 967 inode->i_dquot[type] = NULL; --- 1696 unchanged lines hidden --- | 958 * We can't race with anybody because we hold dqptr_sem for writing... 959 */ 960static int remove_inode_dquot_ref(struct inode *inode, int type, 961 struct list_head *tofree_head) 962{ 963 struct dquot *dquot = inode->i_dquot[type]; 964 965 inode->i_dquot[type] = NULL; --- 1696 unchanged lines hidden --- |