Quota cleanups
Subsystems (6)
Jan Kara
reviewerPATCH 7/16 ext2: Use lowercase names of quota functions
In reply to Jan KaraUse lowercase names of quota functions instead of old uppercase ones.
--- fs/ext2/balloc.c | 8 ++++---- fs/ext2/ialloc.c | 10 +++++----- fs/ext2/inode.c | 2 +- fs/ext2/xattr.c | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-)
fs/ext2/balloc.c +4 -4
@@ -570,7 +570,7 @@ do_more: error_return:brelse (bitmap_bh);release_blocks (sb, freed); -DQUOT_FREE_BLOCK (inode, freed); +vfs_dq_free_block (inode, freed); }/**
@@ -1247,7 +1247,7 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,/* * Check quota for allocation of this block. */ -if (DQUOT_ALLOC_BLOCK (inode, num)) { +if (vfs_dq_alloc_block (inode, num)) { *errp = -EDQUOT ;return 0 ; }
@@ -1409,7 +1409,7 @@ allocated: *errp =0 ;brelse (bitmap_bh); -DQUOT_FREE_BLOCK (inode, *count-num); +vfs_dq_free_block (inode, *count-num); *count = num;return ret_block;
@@ -1420,7 +1420,7 @@ out:* Undo the block allocation */ if (!performed_allocation) -DQUOT_FREE_BLOCK (inode, *count); +vfs_dq_free_block (inode, *count);brelse (bitmap_bh);return 0 ; }
fs/ext2/ialloc.c +5 -5
@@ -121,8 +121,8 @@ void ext2_free_inode (struct inode * inode)if (!is_bad_inode (inode)) {/* Quota is already initialized in iput() */ ext2_xattr_delete_inode (inode); -DQUOT_FREE_INODE (inode); -DQUOT_DROP (inode); +vfs_dq_free_inode (inode); +vfs_dq_drop (inode); } es =EXT2_SB (sb)->s_es;
@@ -586,7 +586,7 @@ got: goto fail_drop; } -if (DQUOT_ALLOC_INODE (inode)) { +if (vfs_dq_alloc_inode (inode)) { err = -EDQUOT ; goto fail_drop; }
@@ -605,10 +605,10 @@ got:return inode; fail_free_drop: -DQUOT_FREE_INODE (inode); +vfs_dq_free_inode (inode); fail_drop: -DQUOT_DROP (inode); +vfs_dq_drop (inode); inode->i_flags |=S_NOQUOTA ; inode->i_nlink =0 ;unlock_new_inode (inode);
fs/ext2/inode.c +1 -1
@@ -1444,7 +1444,7 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr)return error;if ((iattr->ia_valid &ATTR_UID && iattr->ia_uid != inode->i_uid) || (iattr->ia_valid &ATTR_GID && iattr->ia_gid != inode->i_gid)) { - error =DQUOT_TRANSFER (inode, iattr) ? -EDQUOT :0 ; + error =vfs_dq_transfer (inode, iattr) ? -EDQUOT :0 ;if (error)return error; }
fs/ext2/xattr.c +4 -4
@@ -642,7 +642,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,ea_bdebug (new_bh,"reusing block" ); error = -EDQUOT ; -if (DQUOT_ALLOC_BLOCK (inode,1 )) { +if (vfs_dq_alloc_block (inode,1 )) {unlock_buffer (new_bh); goto cleanup; }
@@ -699,7 +699,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,* as if nothing happened and cleanup the unused block */ if (error && error != -ENOSPC ) {if (new_bh && new_bh != old_bh) -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 ); goto cleanup; } }else
@@ -731,7 +731,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,le32_add_cpu (&HDR (old_bh)->h_refcount,-1 );if (ce)mb_cache_entry_release (ce); -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 );mark_buffer_dirty (old_bh);ea_bdebug (old_bh,"refcount now=%d" ,le32_to_cpu (HDR (old_bh)->h_refcount));
@@ -794,7 +794,7 @@ ext2_xattr_delete_inode(struct inode *inode)mark_buffer_dirty (bh);if (IS_SYNC (inode))sync_dirty_buffer (bh); -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 ); }EXT2_I (inode)->i_file_acl =0 ;
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 8/16 ext3: Use lowercase names of quota functions
Use lowercase names of quota functions instead of old uppercase ones.
--- fs/ext3/balloc.c | 8 ++++---- fs/ext3/ialloc.c | 12 ++++++------ fs/ext3/inode.c | 6 +++--- fs/ext3/namei.c | 6 +++--- fs/ext3/super.c | 4 ++-- fs/ext3/xattr.c | 6 +++--- 6 files changed, 21 insertions(+), 21 deletions(-)
fs/ext3/balloc.c +4 -4
@@ -676,7 +676,7 @@ void ext3_free_blocks(handle_t *handle, struct inode *inode, }ext3_free_blocks_sb (handle, sb, block, count, &dquot_freed_blocks);if (dquot_freed_blocks) -DQUOT_FREE_BLOCK (inode, dquot_freed_blocks); +vfs_dq_free_block (inode, dquot_freed_blocks);return ; }
@@ -1502,7 +1502,7 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,/* * Check quota for allocation of this block. */ -if (DQUOT_ALLOC_BLOCK (inode, num)) { +if (vfs_dq_alloc_block (inode, num)) { *errp = -EDQUOT ;return 0 ; }
@@ -1714,7 +1714,7 @@ allocated: *errp =0 ;brelse (bitmap_bh); -DQUOT_FREE_BLOCK (inode, *count-num); +vfs_dq_free_block (inode, *count-num); *count = num;return ret_block;
@@ -1729,7 +1729,7 @@ out:* Undo the block allocation */ if (!performed_allocation) -DQUOT_FREE_BLOCK (inode, *count); +vfs_dq_free_block (inode, *count);brelse (bitmap_bh);return 0 ; }
fs/ext3/ialloc.c +6 -6
@@ -123,10 +123,10 @@ void ext3_free_inode (handle_t *handle, struct inode * inode)* Note: we must free any quota before locking the superblock, * as writing the quota to disk may need the lock as well. */ -DQUOT_INIT (inode); +vfs_dq_init (inode);ext3_xattr_delete_inode (handle, inode); -DQUOT_FREE_INODE (inode); -DQUOT_DROP (inode); +vfs_dq_free_inode (inode); +vfs_dq_drop (inode); is_directory =S_ISDIR (inode->i_mode);
@@ -589,7 +589,7 @@ got: sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0; ret = inode; -if (DQUOT_ALLOC_INODE (inode)) { +if (vfs_dq_alloc_inode (inode)) { err = -EDQUOT ; goto fail_drop; }
@@ -620,10 +620,10 @@ really_out:return ret; fail_free_drop: -DQUOT_FREE_INODE (inode); +vfs_dq_free_inode (inode); fail_drop: -DQUOT_DROP (inode); +vfs_dq_drop (inode); inode->i_flags |=S_NOQUOTA ; inode->i_nlink =0 ;unlock_new_inode (inode);
fs/ext3/inode.c +3 -3
@@ -3055,7 +3055,7 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr) error =PTR_ERR (handle); goto err_out; } - error =DQUOT_TRANSFER (inode, attr) ? -EDQUOT :0 ; + error =vfs_dq_transfer (inode, attr) ? -EDQUOT :0 ;if (error) {ext3_journal_stop (handle);return error;
@@ -3146,7 +3146,7 @@ static int ext3_writepage_trans_blocks(struct inode *inode) ret =2 * (bpp + indirects) +2 ;#ifdef CONFIG_QUOTA -/* We know that structure was already allocated during DQUOT_INIT so +/* We know that structure was already allocated during vfs_dq_init so * we will be updating only the data blocks + inodes */ ret +=2 *EXT3_QUOTA_TRANS_BLOCKS (inode->i_sb);#endif
@@ -3237,7 +3237,7 @@ int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode)* i_size has been changed by generic_commit_write() and we thus need * to include the updated inode in the current transaction. * -* Also, DQUOT_ALLOC_SPACE() will always dirty the inode when blocks +* Also, vfs_dq_alloc_space() will always dirty the inode when blocks * are allocated to the file. * * If the inode is marked synchronous, we don't honour that here - doing
fs/ext3/namei.c +3 -3
@@ -2041,7 +2041,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry)/* Initialize quotas before so that eventual writes go in * separate transaction */ -DQUOT_INIT (dentry->d_inode); +vfs_dq_init (dentry->d_inode); handle =ext3_journal_start (dir,EXT3_DELETE_TRANS_BLOCKS (dir->i_sb));if (IS_ERR (handle))return PTR_ERR (handle);
@@ -2100,7 +2100,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry)/* Initialize quotas before so that eventual writes go * in separate transaction */ -DQUOT_INIT (dentry->d_inode); +vfs_dq_init (dentry->d_inode); handle =ext3_journal_start (dir,EXT3_DELETE_TRANS_BLOCKS (dir->i_sb));if (IS_ERR (handle))return PTR_ERR (handle);
@@ -2264,7 +2264,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,/* Initialize quotas before so that eventual writes go * in separate transaction */ if (new_dentry->d_inode) -DQUOT_INIT (new_dentry->d_inode); +vfs_dq_init (new_dentry->d_inode); handle =ext3_journal_start (old_dir,2 *EXT3_DATA_TRANS_BLOCKS (old_dir->i_sb) +EXT3_INDEX_EXTRA_TRANS_BLOCKS +2 );
fs/ext3/super.c +2 -2
@@ -1436,7 +1436,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, }list_add (&EXT3_I (inode)->i_orphan, &EXT3_SB (sb)->s_orphan); -DQUOT_INIT (inode); +vfs_dq_init (inode);if (inode->i_nlink) { printk(KERN_DEBUG "%s: truncating inode %lu to %Ld bytes\n",
@@ -2699,7 +2699,7 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)* Process 1 Process 2 * ext3_create() quota_sync() * journal_start() write_dquot() -* DQUOT_INIT() down(dqio_mutex) +* vfs_dq_init() down(dqio_mutex) * down(dqio_mutex) journal_start() * */
fs/ext3/xattr.c +3 -3
@@ -498,7 +498,7 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode, error =ext3_journal_dirty_metadata (handle, bh);if (IS_SYNC (inode)) handle->h_sync =1 ; -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 );ea_bdebug (bh,"refcount now=%d; releasing" ,le32_to_cpu (BHDR (bh)->h_refcount));if (ce)
@@ -774,7 +774,7 @@ inserted:/* The old block is released after updating the inode. */ error = -EDQUOT ; -if (DQUOT_ALLOC_BLOCK (inode,1 )) +if (vfs_dq_alloc_block (inode,1 )) goto cleanup; error =ext3_journal_get_write_access (handle, new_bh);
@@ -848,7 +848,7 @@ cleanup:return error; cleanup_dquot: -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 ); goto cleanup; bad_block:
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 9/16 ext4: Use lowercase names of quota functions
Use lowercase names of quota functions instead of old uppercase ones.
--- fs/ext4/balloc.c | 2 +- fs/ext4/ialloc.c | 12 ++++++------ fs/ext4/inode.c | 4 ++-- fs/ext4/mballoc.c | 4 ++-- fs/ext4/namei.c | 6 +++--- fs/ext4/super.c | 6 +++--- fs/ext4/xattr.c | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-)
fs/ext4/balloc.c +1 -1
@@ -536,7 +536,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,ext4_mb_free_blocks (handle, inode, block, count, metadata, &dquot_freed_blocks);if (dquot_freed_blocks) -DQUOT_FREE_BLOCK (inode, dquot_freed_blocks); +vfs_dq_free_block (inode, dquot_freed_blocks);return ; }
fs/ext4/ialloc.c +6 -6
@@ -220,10 +220,10 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)* Note: we must free any quota before locking the superblock, * as writing the quota to disk may need the lock as well. */ -DQUOT_INIT (inode); +vfs_dq_init (inode);ext4_xattr_delete_inode (handle, inode); -DQUOT_FREE_INODE (inode); -DQUOT_DROP (inode); +vfs_dq_free_inode (inode); +vfs_dq_drop (inode); is_directory =S_ISDIR (inode->i_mode);
@@ -904,7 +904,7 @@ got: ei->i_extra_isize =EXT4_SB (sb)->s_want_extra_isize; ret = inode; -if (DQUOT_ALLOC_INODE (inode)) { +if (vfs_dq_alloc_inode (inode)) { err = -EDQUOT ; goto fail_drop; }
@@ -945,10 +945,10 @@ really_out:return ret; fail_free_drop: -DQUOT_FREE_INODE (inode); +vfs_dq_free_inode (inode); fail_drop: -DQUOT_DROP (inode); +vfs_dq_drop (inode); inode->i_flags |=S_NOQUOTA ; inode->i_nlink =0 ;unlock_new_inode (inode);
fs/ext4/inode.c +2 -2
@@ -4619,7 +4619,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) error =PTR_ERR (handle); goto err_out; } - error =DQUOT_TRANSFER (inode, attr) ? -EDQUOT :0 ; + error =vfs_dq_transfer (inode, attr) ? -EDQUOT :0 ;if (error) {ext4_journal_stop (handle);return error;
@@ -4998,7 +4998,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)* i_size has been changed by generic_commit_write() and we thus need * to include the updated inode in the current transaction. * -* Also, DQUOT_ALLOC_SPACE() will always dirty the inode when blocks +* Also, vfs_dq_alloc_block() will always dirty the inode when blocks * are allocated to the file. * * If the inode is marked synchronous, we don't honour that here - doing
fs/ext4/mballoc.c +2 -2
@@ -4576,7 +4576,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,return 0 ; } reserv_blks = ar->len; -while (ar->len &&DQUOT_ALLOC_BLOCK (ar->inode, ar->len)) { +while (ar->len &&vfs_dq_alloc_block (ar->inode, ar->len)) { ar->flags |=EXT4_MB_HINT_NOPREALLOC ; ar->len--; }
@@ -4652,7 +4652,7 @@ out2:kmem_cache_free (ext4_ac_cachep, ac); out1:if (inquota && ar->len < inquota) -DQUOT_FREE_BLOCK (ar->inode, inquota - ar->len); +vfs_dq_free_block (ar->inode, inquota - ar->len); out3:if (!ar->len) {if (!EXT4_I (ar->inode)->i_delalloc_reserved_flag)
fs/ext4/namei.c +3 -3
@@ -2083,7 +2083,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)/* Initialize quotas before so that eventual writes go in * separate transaction */ -DQUOT_INIT (dentry->d_inode); +vfs_dq_init (dentry->d_inode); handle =ext4_journal_start (dir,EXT4_DELETE_TRANS_BLOCKS (dir->i_sb));if (IS_ERR (handle))return PTR_ERR (handle);
@@ -2142,7 +2142,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)/* Initialize quotas before so that eventual writes go * in separate transaction */ -DQUOT_INIT (dentry->d_inode); +vfs_dq_init (dentry->d_inode); handle =ext4_journal_start (dir,EXT4_DELETE_TRANS_BLOCKS (dir->i_sb));if (IS_ERR (handle))return PTR_ERR (handle);
@@ -2309,7 +2309,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,/* Initialize quotas before so that eventual writes go * in separate transaction */ if (new_dentry->d_inode) -DQUOT_INIT (new_dentry->d_inode); +vfs_dq_init (new_dentry->d_inode); handle =ext4_journal_start (old_dir,2 *EXT4_DATA_TRANS_BLOCKS (old_dir->i_sb) +EXT4_INDEX_EXTRA_TRANS_BLOCKS +2 );
fs/ext4/super.c +3 -3
@@ -1804,7 +1804,7 @@ static void ext4_orphan_cleanup(struct super_block *sb, }list_add (&EXT4_I (inode)->i_orphan, &EXT4_SB (sb)->s_orphan); -DQUOT_INIT (inode); +vfs_dq_init (inode);if (inode->i_nlink) { printk(KERN_DEBUG "%s: truncating inode %lu to %lld bytes\n",
@@ -3367,8 +3367,8 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)* is locked for write. Otherwise the are possible deadlocks: * Process 1 Process 2 * ext4_create() quota_sync() -* jbd2_journal_start() write_dquot() -* DQUOT_INIT() down(dqio_mutex) +* jbd2_journal_start() write_dquot() +* vfs_dq_init() down(dqio_mutex) * down(dqio_mutex) jbd2_journal_start() * */
fs/ext4/xattr.c +3 -3
@@ -490,7 +490,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode, error =ext4_handle_dirty_metadata (handle, inode, bh);if (IS_SYNC (inode))ext4_handle_sync (handle); -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 );ea_bdebug (bh,"refcount now=%d; releasing" ,le32_to_cpu (BHDR (bh)->h_refcount));if (ce)
@@ -784,7 +784,7 @@ inserted:/* The old block is released after updating the inode. */ error = -EDQUOT ; -if (DQUOT_ALLOC_BLOCK (inode,1 )) +if (vfs_dq_alloc_block (inode,1 )) goto cleanup; error =ext4_journal_get_write_access (handle, new_bh);
@@ -860,7 +860,7 @@ cleanup:return error; cleanup_dquot: -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 ); goto cleanup; bad_block:
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 10/16 reiserfs: Use lowercase names of quota functions
Use lowercase names of quota functions instead of old uppercase ones.
--- fs/reiserfs/bitmap.c | 14 ++++++++------ fs/reiserfs/inode.c | 10 +++++----- fs/reiserfs/namei.c | 6 +++--- fs/reiserfs/stree.c | 14 +++++++------- fs/reiserfs/super.c | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-)
fs/reiserfs/bitmap.c +8 -6
@@ -430,7 +430,7 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,journal_mark_dirty (th, s, sbh);if (for_unformatted) -DQUOT_FREE_BLOCK_NODIRTY (inode,1 ); +vfs_dq_free_block_nodirty (inode,1 ); } void reiserfs_free_block(struct reiserfs_transaction_handle *th,
@@ -1055,7 +1055,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start amount_needed, hint->inode->i_uid);#endif quota_ret = -DQUOT_ALLOC_BLOCK_NODIRTY (hint->inode, amount_needed); +vfs_dq_alloc_block_nodirty (hint->inode, amount_needed);if (quota_ret)/* Quota exceeded? */ return QUOTA_EXCEEDED ;if (hint->preallocate && hint->prealloc_size) {
@@ -1064,8 +1064,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start"reiserquota: allocating (prealloc) %d blocks id=%u" , hint->prealloc_size, hint->inode->i_uid);#endif - quota_ret = -DQUOT_PREALLOC_BLOCK_NODIRTY (hint->inode, + quota_ret =vfs_dq_prealloc_block_nodirty (hint->inode, hint->prealloc_size);if (quota_ret) hint->preallocate = hint->prealloc_size =0 ;
@@ -1098,7 +1097,10 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start nr_allocated, hint->inode->i_uid);#endif -DQUOT_FREE_BLOCK_NODIRTY (hint->inode, amount_needed + hint->prealloc_size - nr_allocated);/* Free not allocated blocks */ +/* Free not allocated blocks */ +vfs_dq_free_block_nodirty (hint->inode, + amount_needed + hint->prealloc_size - + nr_allocated); }while (nr_allocated--) reiserfs_free_block(hint->th, hint->inode,
@@ -1129,7 +1131,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_startREISERFS_I (hint->inode)->i_prealloc_count, hint->inode->i_uid);#endif -DQUOT_FREE_BLOCK_NODIRTY (hint->inode, amount_needed + +vfs_dq_free_block_nodirty (hint->inode, amount_needed + hint->prealloc_size - nr_allocated -REISERFS_I (hint->inode)-> i_prealloc_count);
fs/reiserfs/inode.c +5 -5
@@ -53,7 +53,7 @@ void reiserfs_delete_inode(struct inode *inode)* after delete_object so that quota updates go into the same transaction as * stat data deletion */ if (!err) -DQUOT_FREE_INODE (inode); +vfs_dq_free_inode (inode);if (journal_end (&th, inode->i_sb, jbegin_count)) goto out;
@@ -1763,7 +1763,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,BUG_ON (!th->t_trans_id); -if (DQUOT_ALLOC_INODE (inode)) { +if (vfs_dq_alloc_inode (inode)) { err = -EDQUOT ; goto out_end_trans; }
@@ -1947,12 +1947,12 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,INODE_PKEY (inode)->k_objectid =0 ;/* Quota change must be inside a transaction for journaling */ -DQUOT_FREE_INODE (inode); +vfs_dq_free_inode (inode); out_end_trans:journal_end (th, th->t_super, th->t_blocks_allocated);/* Drop can be outside and it needs more credits so it's better to have it outside */ -DQUOT_DROP (inode); +vfs_dq_drop (inode); inode->i_flags |=S_NOQUOTA ;make_bad_inode (inode);
@@ -3119,7 +3119,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)if (error) goto out; error = -DQUOT_TRANSFER (inode, attr) ? -EDQUOT :0 ; +vfs_dq_transfer (inode, attr) ? -EDQUOT :0 ;if (error) {journal_end (&th, inode->i_sb, jbegin_count);
fs/reiserfs/namei.c +3 -3
@@ -555,7 +555,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,*/ static int drop_new_inode (struct inode *inode) { -DQUOT_DROP (inode); +vfs_dq_drop (inode);make_bad_inode (inode); inode->i_flags |=S_NOQUOTA ;iput (inode);
@@ -563,7 +563,7 @@ static int drop_new_inode(struct inode *inode) }/* utility function that does setup for reiserfs_new_inode. -** DQUOT_INIT needs lots of credits so it's better to have it +** vfs_dq_init needs lots of credits so it's better to have it ** outside of a transaction, so we had to pull some bits of ** reiserfs_new_inode out into this func. */
@@ -586,7 +586,7 @@ static int new_inode_init(struct inode *inode, struct inode *dir, int mode) }else { inode->i_gid =current_fsgid (); } -DQUOT_INIT (inode); +vfs_dq_init (inode);return 0 ; }
fs/reiserfs/stree.c +7 -7
@@ -1297,7 +1297,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath"reiserquota delete_item(): freeing %u, id=%u type=%c" , quota_cut_bytes, p_s_inode->i_uid, head2type(&s_ih));#endif -DQUOT_FREE_SPACE_NODIRTY (p_s_inode, quota_cut_bytes); +vfs_dq_free_space_nodirty (p_s_inode, quota_cut_bytes);/* Return deleted body length */ return n_ret_value;
@@ -1383,7 +1383,7 @@ void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, quota_cut_bytes, inode->i_uid, key2type(key));#endif -DQUOT_FREE_SPACE_NODIRTY (inode, +vfs_dq_free_space_nodirty (inode, quota_cut_bytes); }break ;
@@ -1734,7 +1734,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,"reiserquota cut_from_item(): freeing %u id=%u type=%c" , quota_cut_bytes, p_s_inode->i_uid, '?');#endif -DQUOT_FREE_SPACE_NODIRTY (p_s_inode, quota_cut_bytes); +vfs_dq_free_space_nodirty (p_s_inode, quota_cut_bytes);return n_ret_value; }
@@ -1971,7 +1971,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree key2type(&(p_s_key->on_disk_key)));#endif -if (DQUOT_ALLOC_SPACE_NODIRTY (inode, n_pasted_size)) { +if (vfs_dq_alloc_space_nodirty (inode, n_pasted_size)) {pathrelse (p_s_search_path);return -EDQUOT ; }
@@ -2027,7 +2027,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree n_pasted_size, inode->i_uid, key2type(&(p_s_key->on_disk_key)));#endif -DQUOT_FREE_SPACE_NODIRTY (inode, n_pasted_size); +vfs_dq_free_space_nodirty (inode, n_pasted_size);return retval; }
@@ -2060,7 +2060,7 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th, struct treepath#endif /* We can't dirty inode here. It would be immediately written but * appropriate stat item isn't inserted yet... */ -if (DQUOT_ALLOC_SPACE_NODIRTY (inode, quota_bytes)) { +if (vfs_dq_alloc_space_nodirty (inode, quota_bytes)) {pathrelse (p_s_path);return -EDQUOT ; }
@@ -2112,6 +2112,6 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th, struct treepath quota_bytes, inode->i_uid, head2type(p_s_ih));#endif if (inode) -DQUOT_FREE_SPACE_NODIRTY (inode, quota_bytes); +vfs_dq_free_space_nodirty (inode, quota_bytes);return retval; }
fs/reiserfs/super.c +1 -1
@@ -250,7 +250,7 @@ static int finish_unfinished(struct super_block *s) retval =remove_save_link_only (s, &save_link_key,0 );continue ; } -DQUOT_INIT (inode); +vfs_dq_init (inode);if (truncate &&S_ISDIR (inode->i_mode)) {/* We got a truncate request for a dir which is impossible.
Signature · 1 line
1.6.0.2
Jan Kara
reviewercover Quota cleanups
This series of patches is a cleanup of disk quotas. It:
* moves quota code into a separate directory,
* replaces old uppercase quota calls in filesystems with new lowercase equivalents,
* removes some superfluous inlines,
* other coding style/readability fixes.
Honza
Jan Kara
reviewerPATCH 1/16 quota: Move quota files into separate directory
Quota subsystem has more and more files. It's time to create a dir for it.
---
fs/Kconfig | 56 +----------------------------------------
fs/Makefile | 6 +---
fs/quota/Kconfig | 59 +++++++++++++++++++++++++++++++++++++++++++
fs/quota/Makefile | 14 ++++++++++
fs/{ => quota}/dquot.c | 0
fs/{ => quota}/quota.c | 0
fs/{ => quota}/quota_tree.c | 0
fs/{ => quota}/quota_tree.h | 0
fs/{ => quota}/quota_v1.c | 0
fs/{ => quota}/quota_v2.c | 0
fs/{ => quota}/quotaio_v1.h | 0
fs/{ => quota}/quotaio_v2.h | 0
12 files changed, 75 insertions(+), 60 deletions(-)
create mode 100644 fs/quota/Kconfig
create mode 100644 fs/quota/Makefile
rename fs/{ => quota}/dquot.c (100%)
rename fs/{ => quota}/quota.c (100%)
rename fs/{ => quota}/quota_tree.c (100%)
rename fs/{ => quota}/quota_tree.h (100%)
rename fs/{ => quota}/quota_v1.c (100%)
rename fs/{ => quota}/quota_v2.c (100%)
rename fs/{ => quota}/quotaio_v1.h (100%)
rename fs/{ => quota}/quotaio_v2.h (100%)fs/Kconfig +1 -55
@@ -292,61 +292,7 @@ endif # BLOCK source "fs/notify/Kconfig" -config QUOTA - bool "Quota support" - help - If you say Y here, you will be able to set per user limits for disk - usage (also called disk quotas). Currently, it works for the - ext2, ext3, and reiserfs file system. ext3 also supports journalled - quotas for which you don't need to run quotacheck(8) after an unclean - shutdown. - For further details, read the Quota mini-HOWTO, available from - <http://www.tldp.org/docs.html#howto>, or the documentation provided - with the quota tools. Probably the quota support is only useful for - multi user systems. If unsure, say N. - -config QUOTA_NETLINK_INTERFACE - bool "Report quota messages through netlink interface" - depends on QUOTA && NET - help - If you say Y here, quota warnings (about exceeding softlimit, reaching - hardlimit, etc.) will be reported through netlink interface. If unsure, - say Y. - -config PRINT_QUOTA_WARNING - bool "Print quota warnings to console (OBSOLETE)" - depends on QUOTA - default y - help - If you say Y here, quota warnings (about exceeding softlimit, reaching - hardlimit, etc.) will be printed to the process' controlling terminal. - Note that this behavior is currently deprecated and may go away in - future. Please use notification via netlink socket instead. - -# Generic support for tree structured quota files. Seleted when needed. -config QUOTA_TREE - tristate - -config QFMT_V1 - tristate "Old quota format support" - depends on QUOTA - help - This quota format was (is) used by kernels earlier than 2.4.22. If - you have quota working and you don't want to convert to new quota - format say Y here. - -config QFMT_V2 - tristate "Quota format v2 support" - depends on QUOTA - select QUOTA_TREE - help - This quota format allows using quotas with 32-bit UIDs/GIDs. If you - need this functionality say Y here. - -config QUOTACTL - bool - depends on XFS_QUOTA || QUOTA - default y +source "fs/quota/Kconfig" config AUTOFS_FS tristate "Kernel automounter support"
fs/Makefile +1 -5
@@ -51,11 +51,7 @@ obj-$(CONFIG_FS_POSIX_ACL) += posix_acl.o xattr_acl.o obj-$(CONFIG_NFS_COMMON) += nfs_common/ obj-$(CONFIG_GENERIC_ACL) += generic_acl.o -obj-$(CONFIG_QUOTA) += dquot.o -obj-$(CONFIG_QFMT_V1) += quota_v1.o -obj-$(CONFIG_QFMT_V2) += quota_v2.o -obj-$(CONFIG_QUOTA_TREE) += quota_tree.o -obj-$(CONFIG_QUOTACTL) += quota.o +obj-y += quota/ obj-$(CONFIG_PROC_FS) += proc/ obj-y += partitions/
fs/quota/Kconfig new file +59 -0
59 lines not on this page · raw message
fs/quota/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +# +# Makefile for the Linux filesystems. +# +# 14 Sep 2000, Christoph Hellwig <[email protected]> +# Rewritten to use lists instead of if-statements. +# + +obj-y := + +obj-$(CONFIG_QUOTA) += dquot.o +obj-$(CONFIG_QFMT_V1) += quota_v1.o +obj-$(CONFIG_QFMT_V2) += quota_v2.o +obj-$(CONFIG_QUOTA_TREE) += quota_tree.o +obj-$(CONFIG_QUOTACTL) += quota.o
fs/quota/dquot.c renamed from fs/dquot.c +0 -0
fs/quota/quota.c renamed from fs/quota.c +0 -0
fs/quota/quota_tree.c renamed from fs/quota_tree.c +0 -0
fs/quota/quota_tree.h renamed from fs/quota_tree.h +0 -0
fs/quota/quota_v1.c renamed from fs/quota_v1.c +0 -0
fs/quota/quota_v2.c renamed from fs/quota_v2.c +0 -0
fs/quota/quotaio_v1.h renamed from fs/quotaio_v1.h +0 -0
fs/quota/quotaio_v2.h renamed from fs/quotaio_v2.h +0 -0
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 2/16 quota: Make global quota locks cacheline aligned
Andrew Morton has suggested that three global quota locks can end up in the same cacheline which can result in bad cacheline ping-pong on SMP machines. Make locks cacheline aligned so that we avoid this problem (thanks goes to Andrew for the idea).
--- fs/quota/dquot.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
fs/quota/dquot.c +3 -3
@@ -129,9 +129,9 @@* i_mutex on quota files is special (it's below dqio_mutex) */ -static DEFINE_SPINLOCK (dq_list_lock); -static DEFINE_SPINLOCK (dq_state_lock); -DEFINE_SPINLOCK (dq_data_lock); +static __cacheline_aligned_in_smp DEFINE_SPINLOCK (dq_list_lock ); +static __cacheline_aligned_in_smp DEFINE_SPINLOCK (dq_state_lock ); +__cacheline_aligned_in_smp DEFINE_SPINLOCK (dq_data_lock );EXPORT_SYMBOL (dq_data_lock);static char *quotatypes[] =INITQFNAMES ;
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 3/16 quota: Remove NODQUOT macro
Remove this macro which is just a definition of NULL. Fix a few coding style issues along the way.
--- fs/quota/dquot.c | 70 +++++++++++++++++++++++++----------------------- include/linux/quota.h | 2 - 2 files changed, 36 insertions(+), 36 deletions(-)
fs/quota/dquot.c +36 -34
@@ -253,7 +253,7 @@ static inline struct dquot *find_dquot(unsigned int hashent, struct super_blockif (dquot->dq_sb == sb && dquot->dq_id == id && dquot->dq_type == type)return dquot; } -return NODQUOT ; +return NULL ; }/* Add a dquot to the tail of the free list */
@@ -696,7 +696,7 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type) dquot = sb->dq_op->alloc_dquot (sb, type);if (!dquot) -return NODQUOT ; +return NULL ;mutex_init (&dquot->dq_lock);INIT_LIST_HEAD (&dquot->dq_free);
@@ -722,10 +722,10 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type)struct dquot *dqget (struct super_block *sb,unsigned int id,int type) {unsigned int hashent =hashfn (sb, id, type); -struct dquot *dquot =NODQUOT , *empty =NODQUOT ; +struct dquot *dquot =NULL , *empty =NULL ;if (!sb_has_quota_active (sb, type)) -return NODQUOT ; +return NULL ; we_slept:spin_lock (&dq_list_lock);spin_lock (&dq_state_lock);
@@ -736,15 +736,17 @@ we_slept: }spin_unlock (&dq_state_lock); -if ((dquot =find_dquot (hashent, sb, id, type)) ==NODQUOT ) { -if (empty ==NODQUOT ) { + dquot =find_dquot (hashent, sb, id, type); +if (!dquot) { +if (!empty) {spin_unlock (&dq_list_lock); -if ((empty =get_empty_dquot (sb, type)) ==NODQUOT ) + empty =get_empty_dquot (sb, type); +if (!empty)schedule ();/* Try to wait for a moment... */ goto we_slept; } dquot = empty; - empty =NODQUOT ; + empty =NULL ; dquot->dq_id = id;/* all dquots go on the inuse_list */ put_inuse (dquot);
@@ -766,7 +768,7 @@ we_slept:/* Read the dquot and instantiate it (everything done only if needed) */ if (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags) && sb->dq_op->acquire_dquot (dquot) <0 ) {dqput (dquot); - dquot =NODQUOT ; + dquot =NULL ; goto out; }#ifdef __DQUOT_PARANOIA
@@ -787,9 +789,9 @@ static int dqinit_needed(struct inode *inode, int type)if (IS_NOQUOTA (inode))return 0 ;if (type !=-1 ) -return inode->i_dquot[type] ==NODQUOT ; +return !inode->i_dquot[type];for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) -if (inode->i_dquot[cnt] ==NODQUOT ) +if (!inode->i_dquot[cnt])return 1 ;return 0 ; }
@@ -840,8 +842,8 @@ static int remove_inode_dquot_ref(struct inode *inode, int type, {struct dquot *dquot = inode->i_dquot[type]; - inode->i_dquot[type] =NODQUOT ; -if (dquot !=NODQUOT ) { + inode->i_dquot[type] =NULL ; +if (dquot) {if (dqput_blocks (dquot)) {#ifdef __DQUOT_PARANOIAif (atomic_read (&dquot->dq_count) !=1 )
@@ -1112,7 +1114,7 @@ static inline void flush_warnings(struct dquot * const *dquots, char *warntype)int i;for (i =0 ; i <MAXQUOTAS ; i++) -if (dquots[i] !=NODQUOT && warntype[i] !=QUOTA_NL_NOWARN && +if (dquots[i] && warntype[i] !=QUOTA_NL_NOWARN && !warning_issued (dquots[i], warntype[i])) {#ifdef CONFIG_PRINT_QUOTA_WARNING print_warning (dquots[i], warntype[i]);
@@ -1249,7 +1251,7 @@ int dquot_initialize(struct inode *inode, int type) {unsigned int id =0 ;int cnt, ret =0 ; -struct dquot *got[MAXQUOTAS ] = {NODQUOT ,NODQUOT }; +struct dquot *got[MAXQUOTAS ] = {NULL ,NULL };struct super_block *sb = inode->i_sb;/* First test before acquiring mutex - solves deadlocks when we
@@ -1282,9 +1284,9 @@ int dquot_initialize(struct inode *inode, int type)/* Avoid races with quotaoff() */ if (!sb_has_quota_active (sb, cnt))continue ; -if (inode->i_dquot[cnt] ==NODQUOT ) { +if (!inode->i_dquot[cnt]) { inode->i_dquot[cnt] = got[cnt]; - got[cnt] =NODQUOT ; + got[cnt] =NULL ; } } out_err:
@@ -1307,7 +1309,7 @@ int dquot_drop(struct inode *inode)down_write (&sb_dqopt (inode->i_sb)->dqptr_sem);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { put[cnt] = inode->i_dquot[cnt]; - inode->i_dquot[cnt] =NODQUOT ; + inode->i_dquot[cnt] =NULL ; }up_write (&sb_dqopt (inode->i_sb)->dqptr_sem);
@@ -1332,7 +1334,7 @@ void vfs_dq_drop(struct inode *inode)* must assure that nobody can come after the DQUOT_DROP and * add quota pointers back anyway */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) -if (inode->i_dquot[cnt] !=NODQUOT ) +if (inode->i_dquot[cnt])break ;if (cnt <MAXQUOTAS ) inode->i_sb->dq_op->drop (inode);
@@ -1363,7 +1365,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number,spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (inode->i_dquot[cnt] ==NODQUOT ) +if (!inode->i_dquot[cnt])continue ;if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) ==NO_QUOTA ) {
@@ -1372,7 +1374,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, } }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (inode->i_dquot[cnt] ==NODQUOT ) +if (!inode->i_dquot[cnt])continue ;if (reserve)dquot_resv_space (inode->i_dquot[cnt], number);
@@ -1461,14 +1463,14 @@ int dquot_alloc_inode(const struct inode *inode, qsize_t number) }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (inode->i_dquot[cnt] ==NODQUOT ) +if (!inode->i_dquot[cnt])continue ;if (check_idq (inode->i_dquot[cnt], number, warntype+cnt) ==NO_QUOTA ) goto warn_put_all; }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (inode->i_dquot[cnt] ==NODQUOT ) +if (!inode->i_dquot[cnt])continue ;dquot_incr_inodes (inode->i_dquot[cnt], number); }
@@ -1506,7 +1508,7 @@ int dquot_claim_space(struct inode *inode, qsize_t number)spin_lock (&dq_data_lock);/* Claim reserved quotas to allocated quotas */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (inode->i_dquot[cnt] !=NODQUOT ) +if (inode->i_dquot[cnt])dquot_claim_reserved_space (inode->i_dquot[cnt], number); }
@@ -1540,7 +1542,7 @@ void dquot_release_reserved_space(struct inode *inode, qsize_t number)spin_lock (&dq_data_lock);/* Release reserved dquots */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (inode->i_dquot[cnt] !=NODQUOT ) +if (inode->i_dquot[cnt])dquot_free_reserved_space (inode->i_dquot[cnt], number); }spin_unlock (&dq_data_lock);
@@ -1576,7 +1578,7 @@ out_sub: }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (inode->i_dquot[cnt] ==NODQUOT ) +if (!inode->i_dquot[cnt])continue ; warntype[cnt] =info_bdq_free (inode->i_dquot[cnt], number);dquot_decr_space (inode->i_dquot[cnt], number);
@@ -1614,7 +1616,7 @@ int dquot_free_inode(const struct inode *inode, qsize_t number) }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (inode->i_dquot[cnt] ==NODQUOT ) +if (!inode->i_dquot[cnt])continue ; warntype[cnt] =info_idq_free (inode->i_dquot[cnt], number);dquot_decr_inodes (inode->i_dquot[cnt], number);
@@ -1667,8 +1669,8 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)return QUOTA_OK ;/* Initialize the arrays */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { - transfer_from[cnt] =NODQUOT ; - transfer_to[cnt] =NODQUOT ; + transfer_from[cnt] =NULL ; + transfer_to[cnt] =NULL ; warntype_to[cnt] =QUOTA_NL_NOWARN ;switch (cnt) {case USRQUOTA :
@@ -1696,7 +1698,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr) space = cur_space + rsv_space;/* Build the transfer_from list and check the limits */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (transfer_to[cnt] ==NODQUOT ) +if (!transfer_to[cnt])continue ; transfer_from[cnt] = inode->i_dquot[cnt]; if (check_idq(transfer_to[cnt], 1, warntype_to + cnt) ==
@@ -1712,7 +1714,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)/* * Skip changes for same uid or gid or for turned off quota-type. */ -if (transfer_to[cnt] ==NODQUOT ) +if (!transfer_to[cnt])continue ;/* Due to IO error we might not have transfer_from[] structure */
@@ -1743,7 +1745,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)if (transfer_to[cnt]) {mark_dquot_dirty (transfer_to[cnt]);/* The reference we got is transferred to the inode */ - transfer_to[cnt] =NODQUOT ; + transfer_to[cnt] =NULL ; } } warn_put_all:
@@ -1761,7 +1763,7 @@ over_quota:up_write (&sb_dqopt (inode->i_sb)->dqptr_sem);/* Clear dquot pointers we don't want to dqput() */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) - transfer_from[cnt] =NODQUOT ; + transfer_from[cnt] =NULL ; ret =NO_QUOTA ; goto warn_put_all; }
@@ -2256,7 +2258,7 @@ int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *dstruct dquot *dquot; dquot =dqget (sb, id, type); -if (dquot ==NODQUOT ) +if (!dquot)return -ESRCH ;do_get_dqblk (dquot, di);dqput (dquot);
include/linux/quota.h +0 -2
@@ -277,8 +277,6 @@ struct dquot {struct mem_dqblk dq_dqb;/* Diskquota usage */ }; -#define NODQUOT (struct dquot *)NULL -#define QUOTA_OK 0#define NO_QUOTA 1
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 5/16 vfs: Use lowercase names of quota functions
In reply to Jan KaraUse lowercase names of quota functions instead of old uppercase ones.
--- fs/attr.c | 3 ++- fs/inode.c | 4 ++-- fs/namei.c | 22 +++++++++++----------- fs/open.c | 2 +- fs/super.c | 8 ++++---- fs/sync.c | 2 +- 6 files changed, 21 insertions(+), 20 deletions(-)
fs/attr.c +2 -1
@@ -173,7 +173,8 @@ int notify_change(struct dentry * dentry, struct iattr * attr)if (!error) {if ((ia_valid &ATTR_UID && attr->ia_uid != inode->i_uid) || (ia_valid &ATTR_GID && attr->ia_gid != inode->i_gid)) - error =DQUOT_TRANSFER (inode, attr) ? -EDQUOT :0 ; + error =vfs_dq_transfer (inode, attr) ? + -EDQUOT :0 ;if (!error) error =inode_setattr (inode, attr); }
fs/inode.c +2 -2
@@ -284,7 +284,7 @@ void clear_inode(struct inode *inode)BUG_ON (!(inode->i_state &I_FREEING ));BUG_ON (inode->i_state &I_CLEAR );inode_sync_wait (inode); -DQUOT_DROP (inode); +vfs_dq_drop (inode);if (inode->i_sb->s_op->clear_inode) inode->i_sb->s_op->clear_inode (inode);if (S_ISBLK (inode->i_mode) && inode->i_bdev)
@@ -1154,7 +1154,7 @@ void generic_delete_inode(struct inode *inode)if (op->delete_inode) {void (*delete)(struct inode *) = op->delete_inode;if (!is_bad_inode (inode)) -DQUOT_INIT (inode); +vfs_dq_init (inode);/* Filesystems implementing their own * s_op->delete_inode are required to call * truncate_inode_pages and clear_inode()
fs/namei.c +11 -11
@@ -1470,7 +1470,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode, error =security_inode_create (dir, dentry, mode);if (error)return error; -DQUOT_INIT (dir); +vfs_dq_init (dir); error = dir->i_op->create (dir, dentry, mode, nd);if (!error)fsnotify_create (dir, dentry);
@@ -1544,7 +1544,7 @@ int may_open(struct path *path, int acc_mode, int flag) error =security_path_truncate (path,0 ,ATTR_MTIME |ATTR_CTIME |ATTR_OPEN );if (!error) { -DQUOT_INIT (inode); +vfs_dq_init (inode); error = do_truncate(dentry, 0, ATTR_MTIME|ATTR_CTIME|ATTR_OPEN,
@@ -1555,7 +1555,7 @@ int may_open(struct path *path, int acc_mode, int flag)return error; }else if (flag &FMODE_WRITE ) -DQUOT_INIT (inode); +vfs_dq_init (inode);return 0 ; }
@@ -1938,7 +1938,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)if (error)return error; -DQUOT_INIT (dir); +vfs_dq_init (dir); error = dir->i_op->mknod (dir, dentry, mode, dev);if (!error)fsnotify_create (dir, dentry);
@@ -2037,7 +2037,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)if (error)return error; -DQUOT_INIT (dir); +vfs_dq_init (dir); error = dir->i_op->mkdir (dir, dentry, mode);if (!error)fsnotify_mkdir (dir, dentry);
@@ -2123,7 +2123,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)if (!dir->i_op->rmdir)return -EPERM ; -DQUOT_INIT (dir); +vfs_dq_init (dir);mutex_lock (&dentry->d_inode->i_mutex);dentry_unhash (dentry);
@@ -2210,7 +2210,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)if (!dir->i_op->unlink)return -EPERM ; -DQUOT_INIT (dir); +vfs_dq_init (dir);mutex_lock (&dentry->d_inode->i_mutex);if (d_mountpoint (dentry))
@@ -2321,7 +2321,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)if (error)return error; -DQUOT_INIT (dir); +vfs_dq_init (dir); error = dir->i_op->symlink (dir, dentry, oldname);if (!error)fsnotify_create (dir, dentry);
@@ -2405,7 +2405,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dereturn error;mutex_lock (&inode->i_mutex); -DQUOT_INIT (dir); +vfs_dq_init (dir); error = dir->i_op->link (old_dentry, dir, new_dentry);mutex_unlock (&inode->i_mutex);if (!error)
@@ -2604,8 +2604,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,if (!old_dir->i_op->rename)return -EPERM ; -DQUOT_INIT (old_dir); -DQUOT_INIT (new_dir); +vfs_dq_init (old_dir); +vfs_dq_init (new_dir); old_name =fsnotify_oldname_init (old_dentry->d_name.name);
fs/open.c +1 -1
@@ -273,7 +273,7 @@ static long do_sys_truncate(const char __user *pathname, loff_t length)if (!error) error =security_path_truncate (&path, length,0 );if (!error) { -DQUOT_INIT (inode); +vfs_dq_init (inode); error =do_truncate (path.dentry, length,0 ,NULL ); }
fs/super.c +4 -4
@@ -182,7 +182,7 @@ void deactivate_super(struct super_block *s)if (atomic_dec_and_lock (&s->s_active, &sb_lock)) { s->s_count -=S_BIAS -1 ;spin_unlock (&sb_lock); -DQUOT_OFF (s,0 ); +vfs_dq_off (s,0 );down_write (&s->s_umount); fs->kill_sb (s);put_filesystem (fs);
@@ -251,7 +251,7 @@ EXPORT_SYMBOL(unlock_super);void __fsync_super (struct super_block *sb) {sync_inodes_sb (sb,0 ); -DQUOT_SYNC (sb); +vfs_dq_sync (sb);lock_super (sb);if (sb->s_dirt && sb->s_op->write_super) sb->s_op->write_super (sb);
@@ -637,7 +637,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)mark_files_ro (sb); else if (!fs_may_remount_ro(sb)) return -EBUSY; - retval =DQUOT_OFF (sb,1 ); + retval =vfs_dq_off (sb,1 );if (retval <0 && retval != -ENOSYS )return -EBUSY ; }
@@ -652,7 +652,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) } sb->s_flags = (sb->s_flags & ~MS_RMT_MASK ) | (flags &MS_RMT_MASK );if (remount_rw) -DQUOT_ON_REMOUNT (sb); +vfs_dq_quota_on_remount (sb);return 0 ; }
fs/sync.c +1 -1
@@ -25,7 +25,7 @@ static void do_sync(unsigned long wait) {wakeup_pdflush (0 );sync_inodes (0 );/* All mappings, inodes and their blockdevs */ -DQUOT_SYNC (NULL ); +vfs_dq_sync (NULL );sync_supers ();/* Write the superblocks */ sync_filesystems (0 );/* Start syncing the filesystems */ sync_filesystems (wait);/* Waitingly sync the filesystems */
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 4/16 quota: Remove dqbuf_t and other cleanups
In reply to Jan KaraRemove bogus typedef which is just a definition of char *. Remove unnecessary type casts.
Substitute freedqbuf() with kfree.
--- fs/quota/quota_tree.c | 104 +++++++++++++++++++++++-------------------------- 1 files changed, 49 insertions(+), 55 deletions(-)
fs/quota/quota_tree.c +49 -55
@@ -22,8 +22,6 @@ MODULE_LICENSE("GPL");#define __QUOTA_QT_PARANOIA -typedef char *dqbuf_t ; -static int get_index (struct qtree_mem_dqinfo *info,qid_t id,int depth) {unsigned int epb = info->dqi_usable_bs >>2 ;
@@ -41,40 +39,35 @@ static inline int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info) / info->dqi_entry_size; } -static dqbuf_t getdqbuf (size_t size) +static char *getdqbuf (size_t size) { -dqbuf_t buf =kmalloc (size,GFP_NOFS ); +char *buf =kmalloc (size,GFP_NOFS );if (!buf)printk (KERN_WARNING "VFS: Not enough memory for quota buffers.\n" );return buf; } -static inline void freedqbuf (dqbuf_t buf) -{ -kfree (buf); -} - -static inline ssize_t read_blk (struct qtree_mem_dqinfo *info,uint blk,dqbuf_t buf) +static inline ssize_t read_blk (struct qtree_mem_dqinfo *info,uint blk,char *buf) {struct super_block *sb = info->dqi_sb;memset (buf,0 , info->dqi_usable_bs); -return sb->s_op->quota_read (sb, info->dqi_type, (char *)buf, +return sb->s_op->quota_read (sb, info->dqi_type, buf, info->dqi_usable_bs, blk << info->dqi_blocksize_bits); } -static inline ssize_t write_blk (struct qtree_mem_dqinfo *info,uint blk,dqbuf_t buf) +static inline ssize_t write_blk (struct qtree_mem_dqinfo *info,uint blk,char *buf) {struct super_block *sb = info->dqi_sb; -return sb->s_op->quota_write (sb, info->dqi_type, (char *)buf, +return sb->s_op->quota_write (sb, info->dqi_type, buf, info->dqi_usable_bs, blk << info->dqi_blocksize_bits); }/* Remove empty block from list and return it */ static int get_free_dqblk (struct qtree_mem_dqinfo *info) { -dqbuf_t buf =getdqbuf (info->dqi_usable_bs); +char *buf =getdqbuf (info->dqi_usable_bs);struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;int ret, blk;
@@ -98,12 +91,12 @@ static int get_free_dqblk(struct qtree_mem_dqinfo *info)mark_info_dirty (info->dqi_sb, info->dqi_type); ret = blk; out_buf: -freedqbuf (buf); +kfree (buf);return ret; }/* Insert empty block to the list */ -static int put_free_dqblk (struct qtree_mem_dqinfo *info,dqbuf_t buf,uint blk) +static int put_free_dqblk (struct qtree_mem_dqinfo *info,char *buf,uint blk) {struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;int err;
@@ -120,9 +113,9 @@ static int put_free_dqblk(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint blk) }/* Remove given block from the list of blocks with free entries */ -static int remove_free_dqentry (struct qtree_mem_dqinfo *info,dqbuf_t buf,uint blk) +static int remove_free_dqentry (struct qtree_mem_dqinfo *info,char *buf,uint blk) { -dqbuf_t tmpbuf =getdqbuf (info->dqi_usable_bs); +char *tmpbuf =getdqbuf (info->dqi_usable_bs);struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;uint nextblk =le32_to_cpu (dh->dqdh_next_free);uint prevblk =le32_to_cpu (dh->dqdh_prev_free);
@@ -153,21 +146,21 @@ static int remove_free_dqentry(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint info->dqi_free_entry = nextblk;mark_info_dirty (info->dqi_sb, info->dqi_type); } -freedqbuf (tmpbuf); +kfree (tmpbuf); dh->dqdh_next_free = dh->dqdh_prev_free =cpu_to_le32 (0 );/* No matter whether write succeeds block is out of list */ if (write_blk (info, blk, buf) <0 )printk (KERN_ERR "VFS: Can't write block (%u) with free entries.\n" , blk);return 0 ; out_buf: -freedqbuf (tmpbuf); +kfree (tmpbuf);return err; }/* Insert given block to the beginning of list with free entries */ -static int insert_free_dqentry (struct qtree_mem_dqinfo *info,dqbuf_t buf,uint blk) +static int insert_free_dqentry (struct qtree_mem_dqinfo *info,char *buf,uint blk) { -dqbuf_t tmpbuf =getdqbuf (info->dqi_usable_bs); +char *tmpbuf =getdqbuf (info->dqi_usable_bs);struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;int err;
@@ -188,12 +181,12 @@ static int insert_free_dqentry(struct qtree_mem_dqinfo *info, dqbuf_t buf, uintif (err <0 ) goto out_buf; } -freedqbuf (tmpbuf); +kfree (tmpbuf); info->dqi_free_entry = blk;mark_info_dirty (info->dqi_sb, info->dqi_type);return 0 ; out_buf: -freedqbuf (tmpbuf); +kfree (tmpbuf);return err; }
@@ -215,7 +208,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, {uint blk, i;struct qt_disk_dqdbheader *dh; -dqbuf_t buf =getdqbuf (info->dqi_usable_bs); +char *buf =getdqbuf (info->dqi_usable_bs);char *ddquot; *err =0 ;
@@ -233,7 +226,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, blk =get_free_dqblk (info);if ((int )blk <0 ) { *err = blk; -freedqbuf (buf); +kfree (buf);return 0 ; }memset (buf,0 , info->dqi_usable_bs);
@@ -253,9 +246,10 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, }le16_add_cpu (&dh->dqdh_entries,1 );/* Find free structure in block */ -for (i =0 , ddquot = ((char *)buf) +sizeof (struct qt_disk_dqdbheader ); +for (i =0 , ddquot = buf +sizeof (struct qt_disk_dqdbheader ); i <qtree_dqstr_in_blk (info) && !qtree_entry_unused (info, ddquot); - i++, ddquot += info->dqi_entry_size); + i++, ddquot += info->dqi_entry_size) + ;#ifdef __QUOTA_QT_PARANOIAif (i ==qtree_dqstr_in_blk (info)) { printk(KERN_ERR "VFS: find_free_dqentry(): Data block full "
@@ -273,10 +267,10 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, dquot->dq_off = (blk << info->dqi_blocksize_bits) +sizeof (struct qt_disk_dqdbheader ) + i * info->dqi_entry_size; -freedqbuf (buf); +kfree (buf);return blk; out_buf: -freedqbuf (buf); +kfree (buf);return 0 ; }
@@ -284,7 +278,7 @@ out_buf:static int do_insert_tree (struct qtree_mem_dqinfo *info,struct dquot *dquot,uint *treeblk,int depth) { -dqbuf_t buf =getdqbuf (info->dqi_usable_bs); +char *buf =getdqbuf (info->dqi_usable_bs);int ret =0 , newson =0 , newact =0 ;__le32 *ref;uint newblk;
@@ -333,7 +327,7 @@ static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,put_free_dqblk (info, buf, *treeblk); } out_buf: -freedqbuf (buf); +kfree (buf);return ret; }
@@ -353,7 +347,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)int type = dquot->dq_type;struct super_block *sb = dquot->dq_sb;ssize_t ret; -dqbuf_t ddquot =getdqbuf (info->dqi_entry_size); +char *ddquot =getdqbuf (info->dqi_entry_size);if (!ddquot)return -ENOMEM ;
@@ -364,15 +358,15 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)if (ret <0 ) {printk (KERN_ERR "VFS: Error %zd occurred while " "creating quota.\n" , ret); -freedqbuf (ddquot); +kfree (ddquot);return ret; } }spin_lock (&dq_data_lock); info->dqi_ops->mem2disk_dqblk (ddquot, dquot);spin_unlock (&dq_data_lock); - ret = sb->s_op->quota_write (sb, type, (char *)ddquot, - info->dqi_entry_size, dquot->dq_off); + ret = sb->s_op->quota_write (sb, type, ddquot, info->dqi_entry_size, + dquot->dq_off);if (ret != info->dqi_entry_size) {printk (KERN_WARNING "VFS: dquota write failed on dev %s\n" , sb->s_id);
@@ -382,7 +376,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) ret =0 ; } dqstats.writes++; -freedqbuf (ddquot); +kfree (ddquot);return ret; }
@@ -393,7 +387,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, uint blk) {struct qt_disk_dqdbheader *dh; -dqbuf_t buf =getdqbuf (info->dqi_usable_bs); +char *buf =getdqbuf (info->dqi_usable_bs);int ret =0 ;if (!buf)
@@ -444,7 +438,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, } dquot->dq_off =0 ;/* Quota is now unattached */ out_buf: -freedqbuf (buf); +kfree (buf);return ret; }
@@ -452,7 +446,7 @@ out_buf:static int remove_tree (struct qtree_mem_dqinfo *info,struct dquot *dquot,uint *blk,int depth) { -dqbuf_t buf =getdqbuf (info->dqi_usable_bs); +char *buf =getdqbuf (info->dqi_usable_bs);int ret =0 ;uint newblk;__le32 *ref = (__le32 *)buf;
@@ -475,9 +469,8 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,int i; ref[get_index (info, dquot->dq_id, depth)] =cpu_to_le32 (0 );/* Block got empty? */ -for (i =0 ; - i < (info->dqi_usable_bs >>2 ) && !ref[i]; - i++); +for (i =0 ; i < (info->dqi_usable_bs >>2 ) && !ref[i]; i++) + ;/* Don't put the root block into the free block list */ if (i == (info->dqi_usable_bs >>2 ) && *blk !=QT_TREEOFF ) {
@@ -491,7 +484,7 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, } } out_buf: -freedqbuf (buf); +kfree (buf);return ret; }
@@ -510,7 +503,7 @@ EXPORT_SYMBOL(qtree_delete_dquot);static loff_t find_block_dqentry (struct qtree_mem_dqinfo *info,struct dquot *dquot,uint blk) { -dqbuf_t buf =getdqbuf (info->dqi_usable_bs); +char *buf =getdqbuf (info->dqi_usable_bs);loff_t ret =0 ;int i;char *ddquot;
@@ -522,9 +515,10 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,printk (KERN_ERR "VFS: Can't read quota tree block %u.\n" , blk); goto out_buf; } -for (i =0 , ddquot = ((char *)buf) +sizeof (struct qt_disk_dqdbheader ); +for (i =0 , ddquot = buf +sizeof (struct qt_disk_dqdbheader ); i <qtree_dqstr_in_blk (info) && !info->dqi_ops->is_id (ddquot, dquot); - i++, ddquot += info->dqi_entry_size); + i++, ddquot += info->dqi_entry_size) + ;if (i ==qtree_dqstr_in_blk (info)) {printk (KERN_ERR "VFS: Quota for id %u referenced " "but not present.\n" , dquot->dq_id);
@@ -535,7 +529,7 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info, qt_disk_dqdbheader) + i * info->dqi_entry_size; } out_buf: -freedqbuf (buf); +kfree (buf);return ret; }
@@ -543,7 +537,7 @@ out_buf:static loff_t find_tree_dqentry (struct qtree_mem_dqinfo *info,struct dquot *dquot,uint blk,int depth) { -dqbuf_t buf =getdqbuf (info->dqi_usable_bs); +char *buf =getdqbuf (info->dqi_usable_bs);loff_t ret =0 ;__le32 *ref = (__le32 *)buf;
@@ -563,7 +557,7 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,else ret =find_block_dqentry (info, dquot, blk); out_buf: -freedqbuf (buf); +kfree (buf);return ret; }
@@ -579,7 +573,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)int type = dquot->dq_type;struct super_block *sb = dquot->dq_sb;loff_t offset; -dqbuf_t ddquot; +char *ddquot;int ret =0 ;#ifdef __QUOTA_QT_PARANOIA
@@ -607,8 +601,8 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) ddquot =getdqbuf (info->dqi_entry_size);if (!ddquot)return -ENOMEM ; - ret = sb->s_op->quota_read (sb, type, (char *)ddquot, - info->dqi_entry_size, dquot->dq_off); + ret = sb->s_op->quota_read (sb, type, ddquot, info->dqi_entry_size, + dquot->dq_off);if (ret != info->dqi_entry_size) {if (ret >=0 ) ret = -EIO ;
@@ -616,7 +610,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) "structure for id %u.\n", dquot->dq_id);set_bit (DQ_FAKE_B , &dquot->dq_flags);memset (&dquot->dq_dqb,0 ,sizeof (struct mem_dqblk )); -freedqbuf (ddquot); +kfree (ddquot); goto out; }spin_lock (&dq_data_lock);
@@ -627,7 +621,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) !dquot->dq_dqb.dqb_isoftlimit)set_bit (DQ_FAKE_B , &dquot->dq_flags);spin_unlock (&dq_data_lock); -freedqbuf (ddquot); +kfree (ddquot); out: dqstats.reads++;return ret;
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 6/16 ramfs: Remove quota call
In reply to Jan KaraRamfs has no bussiness in quotas.
--- fs/ramfs/file-nommu.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
fs/ramfs/file-nommu.c +0 -6
@@ -18,7 +18,6 @@#include <linux/string.h> #include <linux/backing-dev.h> #include <linux/ramfs.h> -#include <linux/quotaops.h> #include <linux/pagevec.h> #include <linux/mman.h>
@@ -201,11 +200,6 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia)if (ret)return ret; -/* by providing our own setattr() method, we skip this quotaism */ -if ((old_ia_valid &ATTR_UID && ia->ia_uid != inode->i_uid) || - (old_ia_valid &ATTR_GID && ia->ia_gid != inode->i_gid)) - ret =DQUOT_TRANSFER (inode, ia) ? -EDQUOT :0 ; -/* pick out size-changing events */ if (ia->ia_valid &ATTR_SIZE ) {loff_t size =i_size_read (inode);
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 11/16 ufs: Use lowercase names of quota functions
In reply to Jan KaraUse lowercase names of quota functions instead of old uppercase ones.
--- fs/ufs/balloc.c | 12 ++++++------ fs/ufs/ialloc.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-)
fs/ufs/balloc.c +6 -6
@@ -85,7 +85,7 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) "bit already cleared for fragment %u", i); } -DQUOT_FREE_BLOCK (inode, count); +vfs_dq_free_block (inode, count);fs32_add (sb, &ucg->cg_cs.cs_nffree, count);
@@ -195,7 +195,7 @@ do_more:ubh_setblock (UCPI_UBH (ucpi), ucpi->c_freeoff, blkno);if ((UFS_SB (sb)->s_flags &UFS_CG_MASK ) ==UFS_CG_44BSD )ufs_clusteracct (sb, ucpi, blkno,1 ); -DQUOT_FREE_BLOCK (inode, uspi->s_fpb); +vfs_dq_free_block (inode, uspi->s_fpb);fs32_add (sb, &ucg->cg_cs.cs_nbfree,1 ); uspi->cs_total.cs_nbfree++;
@@ -556,7 +556,7 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment,fs32_add (sb, &ucg->cg_frsum[fragsize - count],1 );for (i = oldcount; i < newcount; i++)ubh_clrbit (UCPI_UBH (ucpi), ucpi->c_freeoff, fragno + i); -if (DQUOT_ALLOC_BLOCK (inode, count)) { +if (vfs_dq_alloc_block (inode, count)) { *err = -EDQUOT ;return 0 ; }
@@ -664,7 +664,7 @@ cg_found:for (i = count; i < uspi->s_fpb; i++)ubh_setbit (UCPI_UBH (ucpi), ucpi->c_freeoff, goal + i); i = uspi->s_fpb - count; -DQUOT_FREE_BLOCK (inode, i); +vfs_dq_free_block (inode, i);fs32_add (sb, &ucg->cg_cs.cs_nffree, i); uspi->cs_total.cs_nffree += i;
@@ -676,7 +676,7 @@ cg_found: result =ufs_bitmap_search (sb, ucpi, goal, allocsize);if (result ==INVBLOCK )return 0 ; -if (DQUOT_ALLOC_BLOCK (inode, count)) { +if (vfs_dq_alloc_block (inode, count)) { *err = -EDQUOT ;return 0 ; }
@@ -747,7 +747,7 @@ gotit:ubh_clrblock (UCPI_UBH (ucpi), ucpi->c_freeoff, blkno);if ((UFS_SB (sb)->s_flags &UFS_CG_MASK ) ==UFS_CG_44BSD )ufs_clusteracct (sb, ucpi, blkno,-1 ); -if (DQUOT_ALLOC_BLOCK (inode, uspi->s_fpb)) { +if (vfs_dq_alloc_block (inode, uspi->s_fpb)) { *err = -EDQUOT ;return INVBLOCK ; }
fs/ufs/ialloc.c +4 -4
@@ -95,8 +95,8 @@ void ufs_free_inode (struct inode * inode) is_directory =S_ISDIR (inode->i_mode); -DQUOT_FREE_INODE (inode); -DQUOT_DROP (inode); +vfs_dq_free_inode (inode); +vfs_dq_drop (inode);clear_inode (inode);
@@ -355,8 +355,8 @@ cg_found:unlock_super (sb); -if (DQUOT_ALLOC_INODE (inode)) { -DQUOT_DROP (inode); +if (vfs_dq_alloc_inode (inode)) { +vfs_dq_drop (inode); err = -EDQUOT ; goto fail_without_unlock; }
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 12/16 udf: Use lowercase names of quota functions
Use lowercase names of quota functions instead of old uppercase ones.
--- fs/udf/balloc.c | 14 +++++++------- fs/udf/ialloc.c | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-)
fs/udf/balloc.c +7 -7
@@ -206,7 +206,7 @@ static void udf_bitmap_free_blocks(struct super_block *sb, ((char *)bh->b_data)[(bit + i) >> 3]); }else {if (inode) -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 );udf_add_free_space (sbi, sbi->s_partition,1 ); } }
@@ -261,11 +261,11 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb,while (bit < (sb->s_blocksize <<3 ) && block_count >0 ) {if (!udf_test_bit (bit, bh->b_data)) goto out; -else if (DQUOT_PREALLOC_BLOCK (inode,1 )) +else if (vfs_dq_prealloc_block (inode,1 )) goto out;else if (!udf_clear_bit (bit, bh->b_data)) {udf_debug ("bit already cleared for block %d\n" , bit); -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 ); goto out; } block_count--;
@@ -393,7 +393,7 @@ got_block:/* * Check quota for allocation of this block. */ -if (inode &&DQUOT_ALLOC_BLOCK (inode,1 )) { +if (inode &&vfs_dq_alloc_block (inode,1 )) {mutex_unlock (&sbi->s_alloc_mutex); *err = -EDQUOT ;return 0 ;
@@ -452,7 +452,7 @@ static void udf_table_free_blocks(struct super_block *sb,/* We do this up front - There are some error conditions that could occure, but.. oh well */ if (inode) -DQUOT_FREE_BLOCK (inode, count); +vfs_dq_free_block (inode, count);if (udf_add_free_space (sbi, sbi->s_partition, count))mark_buffer_dirty (sbi->s_lvid_bh);
@@ -700,7 +700,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb, epos.offset -= adsize; alloc_count = (elen >> sb->s_blocksize_bits); -if (inode &&DQUOT_PREALLOC_BLOCK (inode, +if (inode &&vfs_dq_prealloc_block (inode, alloc_count > block_count ? block_count : alloc_count)) alloc_count =0 ;else if (alloc_count > block_count) {
@@ -806,7 +806,7 @@ static int udf_table_new_block(struct super_block *sb, goal_eloc.logicalBlockNum++; goal_elen -= sb->s_blocksize; -if (inode &&DQUOT_ALLOC_BLOCK (inode,1 )) { +if (inode &&vfs_dq_alloc_block (inode,1 )) {brelse (goal_epos.bh);mutex_unlock (&sbi->s_alloc_mutex); *err = -EDQUOT ;
fs/udf/ialloc.c +4 -4
@@ -36,8 +36,8 @@ void udf_free_inode(struct inode *inode)* Note: we must free any quota before locking the superblock, * as writing the quota to disk may need the lock as well. */ -DQUOT_FREE_INODE (inode); -DQUOT_DROP (inode); +vfs_dq_free_inode (inode); +vfs_dq_drop (inode);clear_inode (inode);
@@ -154,8 +154,8 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)insert_inode_hash (inode);mark_inode_dirty (inode); -if (DQUOT_ALLOC_INODE (inode)) { -DQUOT_DROP (inode); +if (vfs_dq_alloc_inode (inode)) { +vfs_dq_drop (inode); inode->i_flags |=S_NOQUOTA ; inode->i_nlink =0 ;iput (inode);
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 14/16 quota: Remove uppercase aliases for quota functions.
In reply to Jan KaraSince all users have been converted, remove uppercase names of quota functions.
--- include/linux/quotaops.h | 31 ------------------------------- 1 files changed, 0 insertions(+), 31 deletions(-)
include/linux/quotaops.h +0 -31
@@ -454,35 +454,4 @@ static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) vfs_dq_free_space(inode, nr << inode->i_blkbits); } -/* -* Define uppercase equivalents for compatibility with old function names -* Can go away when we think all users have been converted (15/04/2008) -*/ -#define DQUOT_INIT (inode) vfs_dq_init(inode) -#define DQUOT_DROP (inode) vfs_dq_drop(inode) -#define DQUOT_PREALLOC_SPACE_NODIRTY (inode, nr) \ - vfs_dq_prealloc_space_nodirty(inode, nr) -#define DQUOT_PREALLOC_SPACE (inode, nr) vfs_dq_prealloc_space(inode, nr) -#define DQUOT_ALLOC_SPACE_NODIRTY (inode, nr) \ - vfs_dq_alloc_space_nodirty(inode, nr) -#define DQUOT_ALLOC_SPACE (inode, nr) vfs_dq_alloc_space(inode, nr) -#define DQUOT_PREALLOC_BLOCK_NODIRTY (inode, nr) \ - vfs_dq_prealloc_block_nodirty(inode, nr) -#define DQUOT_PREALLOC_BLOCK (inode, nr) vfs_dq_prealloc_block(inode, nr) -#define DQUOT_ALLOC_BLOCK_NODIRTY (inode, nr) \ - vfs_dq_alloc_block_nodirty(inode, nr) -#define DQUOT_ALLOC_BLOCK (inode, nr) vfs_dq_alloc_block(inode, nr) -#define DQUOT_ALLOC_INODE (inode) vfs_dq_alloc_inode(inode) -#define DQUOT_FREE_SPACE_NODIRTY (inode, nr) \ - vfs_dq_free_space_nodirty(inode, nr) -#define DQUOT_FREE_SPACE (inode, nr) vfs_dq_free_space(inode, nr) -#define DQUOT_FREE_BLOCK_NODIRTY (inode, nr) \ - vfs_dq_free_block_nodirty(inode, nr) -#define DQUOT_FREE_BLOCK (inode, nr) vfs_dq_free_block(inode, nr) -#define DQUOT_FREE_INODE (inode) vfs_dq_free_inode(inode) -#define DQUOT_TRANSFER (inode, iattr) vfs_dq_transfer(inode, iattr) -#define DQUOT_SYNC (sb) vfs_dq_sync(sb) -#define DQUOT_OFF (sb, remount) vfs_dq_off(sb, remount) -#define DQUOT_ON_REMOUNT (sb) vfs_dq_quota_on_remount(sb) -#endif /* _LINUX_QUOTAOPS_ */
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 13/16 jfs: Use lowercase names of quota functions
In reply to Jan KaraUse lowercase names of quota functions instead of old uppercase ones.
--- fs/jfs/acl.c | 2 +- fs/jfs/inode.c | 6 +++--- fs/jfs/jfs_dtree.c | 18 +++++++++--------- fs/jfs/jfs_extent.c | 10 +++++----- fs/jfs/jfs_inode.c | 4 ++-- fs/jfs/jfs_xtree.c | 14 +++++++------- fs/jfs/namei.c | 6 +++--- fs/jfs/xattr.c | 12 ++++++------ 8 files changed, 36 insertions(+), 36 deletions(-)
fs/jfs/acl.c +1 -1
@@ -233,7 +233,7 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)if ((iattr->ia_valid &ATTR_UID && iattr->ia_uid != inode->i_uid) || (iattr->ia_valid &ATTR_GID && iattr->ia_gid != inode->i_gid)) { -if (DQUOT_TRANSFER (inode, iattr)) +if (vfs_dq_transfer (inode, iattr))return -EDQUOT ; }
fs/jfs/inode.c +3 -3
@@ -158,9 +158,9 @@ void jfs_delete_inode(struct inode *inode)/* * Free the inode from the quota allocation. */ -DQUOT_INIT (inode); -DQUOT_FREE_INODE (inode); -DQUOT_DROP (inode); +vfs_dq_init (inode); +vfs_dq_free_inode (inode); +vfs_dq_drop (inode); }clear_inode (inode);
fs/jfs/jfs_dtree.c +9 -9
@@ -381,10 +381,10 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)* It's time to move the inline table to an external * page and begin to build the xtree */ -if (DQUOT_ALLOC_BLOCK (ip, sbi->nbperpage)) +if (vfs_dq_alloc_block (ip, sbi->nbperpage)) goto clean_up;if (dbAlloc (ip,0 , sbi->nbperpage, &xaddr)) { -DQUOT_FREE_BLOCK (ip, sbi->nbperpage); +vfs_dq_free_block (ip, sbi->nbperpage); goto clean_up; }
@@ -408,7 +408,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)memcpy (&jfs_ip->i_dirtable, temp_table,sizeof (temp_table));dbFree (ip, xaddr, sbi->nbperpage); -DQUOT_FREE_BLOCK (ip, sbi->nbperpage); +vfs_dq_free_block (ip, sbi->nbperpage); goto clean_up; } ip->i_size =PSIZE ;
@@ -1027,7 +1027,7 @@ static int dtSplitUp(tid_t tid, n = xlen;/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip, n)) { +if (vfs_dq_alloc_block (ip, n)) { rc = -EDQUOT ; goto extendOut; }
@@ -1308,7 +1308,7 @@ static int dtSplitUp(tid_t tid,/* Rollback quota allocation */ if (rc && quota_allocation) -DQUOT_FREE_BLOCK (ip, quota_allocation); +vfs_dq_free_block (ip, quota_allocation); dtSplitUp_Exit:
@@ -1369,7 +1369,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,return -EIO ;/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip,lengthPXD (pxd))) { +if (vfs_dq_alloc_block (ip,lengthPXD (pxd))) {release_metapage (rmp);return -EDQUOT ; }
@@ -1916,7 +1916,7 @@ static int dtSplitRoot(tid_t tid, rp = rmp->data;/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip,lengthPXD (pxd))) { +if (vfs_dq_alloc_block (ip,lengthPXD (pxd))) {release_metapage (rmp);return -EDQUOT ; }
@@ -2287,7 +2287,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip, xlen =lengthPXD (&fp->header.self);/* Free quota allocation. */ -DQUOT_FREE_BLOCK (ip, xlen); +vfs_dq_free_block (ip, xlen);/* free/invalidate its buffer page */ discard_metapage (fmp);
@@ -2363,7 +2363,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip, xlen =lengthPXD (&p->header.self);/* Free quota allocation */ -DQUOT_FREE_BLOCK (ip, xlen); +vfs_dq_free_block (ip, xlen);/* free/invalidate its buffer page */ discard_metapage (mp);
fs/jfs/jfs_extent.c +5 -5
@@ -141,7 +141,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) }/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip, nxlen)) { +if (vfs_dq_alloc_block (ip, nxlen)) {dbFree (ip, nxaddr, (s64 ) nxlen);mutex_unlock (&JFS_IP (ip)->commit_mutex);return -EDQUOT ;
@@ -164,7 +164,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr)*/ if (rc) {dbFree (ip, nxaddr, nxlen); -DQUOT_FREE_BLOCK (ip, nxlen); +vfs_dq_free_block (ip, nxlen);mutex_unlock (&JFS_IP (ip)->commit_mutex);return (rc); }
@@ -256,7 +256,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr) goto exit;/* Allocat blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip, nxlen)) { +if (vfs_dq_alloc_block (ip, nxlen)) {dbFree (ip, nxaddr, (s64 ) nxlen);mutex_unlock (&JFS_IP (ip)->commit_mutex);return -EDQUOT ;
@@ -297,7 +297,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)/* extend the extent */ if ((rc =xtExtend (0 , ip, xoff + xlen, (int ) nextend,0 ))) {dbFree (ip, xaddr + xlen, delta); -DQUOT_FREE_BLOCK (ip, nxlen); +vfs_dq_free_block (ip, nxlen); goto exit; } }else {
@@ -308,7 +308,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)*/ if ((rc =xtTailgate (0 , ip, xoff, (int ) ntail, nxaddr,0 ))) {dbFree (ip, nxaddr, nxlen); -DQUOT_FREE_BLOCK (ip, nxlen); +vfs_dq_free_block (ip, nxlen); goto exit; } }
fs/jfs/jfs_inode.c +2 -2
@@ -116,7 +116,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)/* * Allocate inode to quota. */ -if (DQUOT_ALLOC_INODE (inode)) { +if (vfs_dq_alloc_inode (inode)) { rc = -EDQUOT ; goto fail_drop; }
@@ -162,7 +162,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)return inode; fail_drop: -DQUOT_DROP (inode); +vfs_dq_drop (inode); inode->i_flags |=S_NOQUOTA ; fail_unlock: inode->i_nlink =0 ;
fs/jfs/jfs_xtree.c +7 -7
@@ -846,10 +846,10 @@ int xtInsert(tid_t tid, /* transaction id */ hint =addressXAD (xad) +lengthXAD (xad) -1 ; }else hint =0 ; -if ((rc =DQUOT_ALLOC_BLOCK (ip, xlen))) +if ((rc =vfs_dq_alloc_block (ip, xlen))) goto out;if ((rc =dbAlloc (ip, hint, (s64 ) xlen, &xaddr))) { -DQUOT_FREE_BLOCK (ip, xlen); +vfs_dq_free_block (ip, xlen); goto out; } }
@@ -878,7 +878,7 @@ int xtInsert(tid_t tid, /* transaction id *//* undo data extent allocation */ if (*xaddrp ==0 ) {dbFree (ip, xaddr, (s64 ) xlen); -DQUOT_FREE_BLOCK (ip, xlen); +vfs_dq_free_block (ip, xlen); }return rc; }
@@ -1246,7 +1246,7 @@ xtSplitPage(tid_t tid, struct inode *ip, rbn =addressPXD (pxd);/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip,lengthPXD (pxd))) { +if (vfs_dq_alloc_block (ip,lengthPXD (pxd))) { rc = -EDQUOT ; goto clean_up; }
@@ -1456,7 +1456,7 @@ xtSplitPage(tid_t tid, struct inode *ip,/* Rollback quota allocation. */ if (quota_allocation) -DQUOT_FREE_BLOCK (ip, quota_allocation); +vfs_dq_free_block (ip, quota_allocation);return (rc); }
@@ -1513,7 +1513,7 @@ xtSplitRoot(tid_t tid,return -EIO ;/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip,lengthPXD (pxd))) { +if (vfs_dq_alloc_block (ip,lengthPXD (pxd))) {release_metapage (rmp);return -EDQUOT ; }
@@ -3941,7 +3941,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) ip->i_size = newsize;/* update quota allocation to reflect freed blocks */ -DQUOT_FREE_BLOCK (ip, nfreed); +vfs_dq_free_block (ip, nfreed);/* * free tlock of invalidated pages
fs/jfs/namei.c +3 -3
@@ -356,7 +356,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)jfs_info ("jfs_rmdir: dip:0x%p name:%s" , dip, dentry->d_name.name);/* Init inode for quota operations. */ -DQUOT_INIT (ip); +vfs_dq_init (ip);/* directory must be empty to be removed */ if (!dtEmpty (ip)) {
@@ -483,7 +483,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)jfs_info ("jfs_unlink: dip:0x%p name:%s" , dip, dentry->d_name.name);/* Init inode for quota operations. */ -DQUOT_INIT (ip); +vfs_dq_init (ip);if ((rc =get_UCSname (&dname, dentry))) goto out;
@@ -1136,7 +1136,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, }else if (new_ip) {IWRITE_LOCK (new_ip,RDWRLOCK_NORMAL );/* Init inode for quota operations. */ -DQUOT_INIT (new_ip); +vfs_dq_init (new_ip); }/*
fs/jfs/xattr.c +6 -6
@@ -260,14 +260,14 @@ static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size, nblocks = (size + (sb->s_blocksize -1 )) >> sb->s_blocksize_bits;/* Allocate new blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip, nblocks)) { +if (vfs_dq_alloc_block (ip, nblocks)) {return -EDQUOT ; } rc =dbAlloc (ip,INOHINT (ip), nblocks, &blkno);if (rc) {/*Rollback quota allocation. */ -DQUOT_FREE_BLOCK (ip, nblocks); +vfs_dq_free_block (ip, nblocks);return rc; }
@@ -332,7 +332,7 @@ static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size, failed:/* Rollback quota allocation. */ -DQUOT_FREE_BLOCK (ip, nblocks); +vfs_dq_free_block (ip, nblocks);dbFree (ip, blkno, nblocks);return rc;
@@ -538,7 +538,7 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)if (blocks_needed > current_blocks) {/* Allocate new blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (inode, blocks_needed)) +if (vfs_dq_alloc_block (inode, blocks_needed))return -EDQUOT ; quota_allocation = blocks_needed;
@@ -602,7 +602,7 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size) clean_up:/* Rollback quota allocation */ if (quota_allocation) -DQUOT_FREE_BLOCK (inode, quota_allocation); +vfs_dq_free_block (inode, quota_allocation);return (rc); }
@@ -677,7 +677,7 @@ static int ea_put(tid_t tid, struct inode *inode, struct ea_buffer *ea_buf,/* If old blocks exist, they must be removed from quota allocation. */ if (old_blocks) -DQUOT_FREE_BLOCK (inode, old_blocks); +vfs_dq_free_block (inode, old_blocks); inode->i_ctime =CURRENT_TIME ;
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 15/16 quota: Remove superfluous inlines
In reply to Jan KaraRemove inlines of large functions to decrease code size (saved 1543 bytes).
--- fs/quota/dquot.c | 13 +++++++------ fs/quota/quota.c | 2 +- fs/quota/quota_tree.c | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-)
fs/quota/dquot.c +7 -6
@@ -243,7 +243,8 @@ static inline void remove_dquot_hash(struct dquot *dquot)hlist_del_init (&dquot->dq_hash); } -static inline struct dquot *find_dquot (unsigned int hashent,struct super_block *sb,unsigned int id,int type) +static struct dquot *find_dquot (unsigned int hashent,struct super_block *sb, +unsigned int id,int type) {struct hlist_node *node;struct dquot *dquot;
@@ -935,7 +936,7 @@ void dquot_free_reserved_space(struct dquot *dquot, qsize_t number) dquot->dq_dqb.dqb_rsvspace -= number; } -static inline void dquot_decr_inodes (struct dquot *dquot,qsize_t number) +static void dquot_decr_inodes (struct dquot *dquot,qsize_t number) {if (sb_dqopt (dquot->dq_sb)->flags &DQUOT_NEGATIVE_USAGE || dquot->dq_dqb.dqb_curinodes >= number)
@@ -947,7 +948,7 @@ static inline void dquot_decr_inodes(struct dquot *dquot, qsize_t number)clear_bit (DQ_INODES_B , &dquot->dq_flags); } -static inline void dquot_decr_space (struct dquot *dquot,qsize_t number) +static void dquot_decr_space (struct dquot *dquot,qsize_t number) {if (sb_dqopt (dquot->dq_sb)->flags &DQUOT_NEGATIVE_USAGE || dquot->dq_dqb.dqb_curspace >= number)
@@ -974,7 +975,7 @@ static int warning_issued(struct dquot *dquot, const int warntype)#ifdef CONFIG_PRINT_QUOTA_WARNING static int flag_print_warnings =1 ; -static inline int need_print_warning (struct dquot *dquot) +static int need_print_warning (struct dquot *dquot) {if (!flag_print_warnings)return 0 ;
@@ -1109,7 +1110,7 @@ err_out:* * Note that this function can sleep. */ -static inline void flush_warnings (struct dquot *const *dquots,char *warntype) +static void flush_warnings (struct dquot *const *dquots,char *warntype) {int i;
@@ -1125,7 +1126,7 @@ static inline void flush_warnings(struct dquot * const *dquots, char *warntype) } } -static inline char ignore_hardlimit (struct dquot *dquot) +static int ignore_hardlimit (struct dquot *dquot) {struct mem_dqinfo *info = &sb_dqopt (dquot->dq_sb)->info[dquot->dq_type];
fs/quota/quota.c +1 -1
@@ -341,7 +341,7 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, void* look up a superblock on which quota ops will be performed * - use the name of a block device to find the superblock thereon */ -static inline struct super_block *quotactl_block (const char __user *special) +static struct super_block *quotactl_block (const char __user *special) {#ifdef CONFIG_BLOCK struct block_device *bdev;
fs/quota/quota_tree.c +3 -3
@@ -33,7 +33,7 @@ static int get_index(struct qtree_mem_dqinfo *info, qid_t id, int depth) }/* Number of entries in one blocks */ -static inline int qtree_dqstr_in_blk (struct qtree_mem_dqinfo *info) +static int qtree_dqstr_in_blk (struct qtree_mem_dqinfo *info) {return (info->dqi_usable_bs -sizeof (struct qt_disk_dqdbheader )) / info->dqi_entry_size;
@@ -47,7 +47,7 @@ static char *getdqbuf(size_t size)return buf; } -static inline ssize_t read_blk (struct qtree_mem_dqinfo *info,uint blk,char *buf) +static ssize_t read_blk (struct qtree_mem_dqinfo *info,uint blk,char *buf) {struct super_block *sb = info->dqi_sb;
@@ -56,7 +56,7 @@ static inline ssize_t read_blk(struct qtree_mem_dqinfo *info, uint blk, char *bu info->dqi_usable_bs, blk << info->dqi_blocksize_bits); } -static inline ssize_t write_blk (struct qtree_mem_dqinfo *info,uint blk,char *buf) +static ssize_t write_blk (struct qtree_mem_dqinfo *info,uint blk,char *buf) {struct super_block *sb = info->dqi_sb;
Signature · 1 line
1.6.0.2
Jan Kara
reviewerPATCH 16/16 quota: Coding style fixes
Wrap long lines, remove assignments from conditions, rewrite two overcomplicated for loops.
--- fs/quota/dquot.c | 179 ++++++++++++++++++++++++++++++------------------ fs/quota/quota.c | 35 ++++++--- fs/quota/quota_tree.c | 42 ++++++++---- fs/quota/quota_v1.c | 48 +++++++++----- fs/quota/quota_v2.c | 3 +- 5 files changed, 196 insertions(+), 111 deletions(-)
fs/quota/dquot.c +112 -67
@@ -156,7 +156,9 @@ void unregister_quota_format(struct quota_format_type *fmt)struct quota_format_type **actqf;spin_lock (&dq_list_lock); -for (actqf = "a_formats; *actqf && *actqf != fmt; actqf = &(*actqf)->qf_next); +for (actqf = "a_formats; *actqf && *actqf != fmt; + actqf = &(*actqf)->qf_next) + ;if (*actqf) *actqf = (*actqf)->qf_next;spin_unlock (&dq_list_lock);
@@ -168,18 +170,25 @@ static struct quota_format_type *find_quota_format(int id)struct quota_format_type *actqf;spin_lock (&dq_list_lock); -for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next); +for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; + actqf = actqf->qf_next) + ;if (!actqf || !try_module_get (actqf->qf_owner)) {int qm;spin_unlock (&dq_list_lock); -for (qm =0 ; module_names[qm].qm_fmt_id && module_names[qm].qm_fmt_id != id; qm++); -if (!module_names[qm].qm_fmt_id ||request_module (module_names[qm].qm_mod_name)) +for (qm =0 ; module_names[qm].qm_fmt_id && + module_names[qm].qm_fmt_id != id; qm++) + ; +if (!module_names[qm].qm_fmt_id || +request_module (module_names[qm].qm_mod_name))return NULL ;spin_lock (&dq_list_lock); -for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next); +for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; + actqf = actqf->qf_next) + ;if (actqf && !try_module_get (actqf->qf_owner)) actqf =NULL ; }
@@ -234,7 +243,8 @@ hashfn(const struct super_block *sb, unsigned int id, int type)*/ static inline void insert_dquot_hash (struct dquot *dquot) { -struct hlist_head *head = dquot_hash +hashfn (dquot->dq_sb, dquot->dq_id, dquot->dq_type); +struct hlist_head *head; + head = dquot_hash +hashfn (dquot->dq_sb, dquot->dq_id, dquot->dq_type);hlist_add_head (&dquot->dq_hash, head); }
@@ -251,7 +261,8 @@ static struct dquot *find_dquot(unsigned int hashent, struct super_block *sb, hlist_for_each (node, dquot_hash+hashent) { dquot = hlist_entry(node, struct dquot, dq_hash); -if (dquot->dq_sb == sb && dquot->dq_id == id && dquot->dq_type == type) +if (dquot->dq_sb == sb && dquot->dq_id == id && + dquot->dq_type == type)return dquot; }return NULL ;
@@ -351,8 +362,10 @@ int dquot_acquire(struct dquot *dquot)if (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags) && !dquot->dq_off) { ret = dqopt->ops[dquot->dq_type]->commit_dqblk (dquot);/* Write the info if needed */ -if (info_dirty (&dqopt->info[dquot->dq_type])) - ret2 = dqopt->ops[dquot->dq_type]->write_file_info (dquot->dq_sb, dquot->dq_type); +if (info_dirty (&dqopt->info[dquot->dq_type])) { + ret2 = dqopt->ops[dquot->dq_type]->write_file_info ( + dquot->dq_sb, dquot->dq_type); + }if (ret <0 ) goto out_iolock;if (ret2 <0 ) {
@@ -387,8 +400,10 @@ int dquot_commit(struct dquot *dquot)* => we have better not writing it */ if (test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) { ret = dqopt->ops[dquot->dq_type]->commit_dqblk (dquot); -if (info_dirty (&dqopt->info[dquot->dq_type])) - ret2 = dqopt->ops[dquot->dq_type]->write_file_info (dquot->dq_sb, dquot->dq_type); +if (info_dirty (&dqopt->info[dquot->dq_type])) { + ret2 = dqopt->ops[dquot->dq_type]->write_file_info ( + dquot->dq_sb, dquot->dq_type); + }if (ret >=0 ) ret = ret2; }
@@ -414,8 +429,10 @@ int dquot_release(struct dquot *dquot)if (dqopt->ops[dquot->dq_type]->release_dqblk) { ret = dqopt->ops[dquot->dq_type]->release_dqblk (dquot);/* Write the info */ -if (info_dirty (&dqopt->info[dquot->dq_type])) - ret2 = dqopt->ops[dquot->dq_type]->write_file_info (dquot->dq_sb, dquot->dq_type); +if (info_dirty (&dqopt->info[dquot->dq_type])) { + ret2 = dqopt->ops[dquot->dq_type]->write_file_info ( + dquot->dq_sb, dquot->dq_type); + }if (ret >=0 ) ret = ret2; }
@@ -543,7 +560,8 @@ int vfs_quota_sync(struct super_block *sb, int type)spin_lock (&dq_list_lock); dirty = &dqopt->info[cnt].dqi_dirty_list;while (!list_empty (dirty)) { - dquot = list_first_entry(dirty, struct dquot, dq_dirty); + dquot = list_first_entry(dirty, struct dquot, + dq_dirty);/* Dirty and inactive can be only bad dquot... */ if (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) {clear_dquot_dirty (dquot);
@@ -763,11 +781,12 @@ we_slept: dqstats.lookups++;spin_unlock (&dq_list_lock); } -/* Wait for dq_lock - after this we know that either dquot_release() is already -* finished or it will be canceled due to dq_count > 1 test */ +/* Wait for dq_lock - after this we know that either dquot_release() is +* already finished or it will be canceled due to dq_count > 1 test */ wait_on_dquot (dquot); -/* Read the dquot and instantiate it (everything done only if needed) */ -if (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags) && sb->dq_op->acquire_dquot (dquot) <0 ) { +/* Read the dquot / allocate space in quota file */ +if (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags) && + sb->dq_op->acquire_dquot (dquot) <0 ) {dqput (dquot); dquot =NULL ; goto out;
@@ -828,7 +847,10 @@ static void add_dquot_ref(struct super_block *sb, int type)iput (old_inode); } -/* Return 0 if dqput() won't block (note that 1 doesn't necessarily mean blocking) */ +/* +* Return 0 if dqput() won't block. +* (note that 1 doesn't necessarily mean blocking) +*/ static inline int dqput_blocks (struct dquot *dquot) {if (atomic_read (&dquot->dq_count) <=1 )
@@ -836,8 +858,11 @@ static inline int dqput_blocks(struct dquot *dquot)return 0 ; } -/* Remove references to dquots from inode - add dquot to list for freeing if needed */ -/* We can't race with anybody because we hold dqptr_sem for writing... */ +/* +* Remove references to dquots from inode and add dquot to list for freeing +* if we have the last referece to dquot +* We can't race with anybody because we hold dqptr_sem for writing... +*/ static int remove_inode_dquot_ref (struct inode *inode,int type,struct list_head *tofree_head) {
@@ -851,7 +876,9 @@ static int remove_inode_dquot_ref(struct inode *inode, int type,printk (KERN_WARNING "VFS: Adding dquot with dq_count %d to dispose list.\n" ,atomic_read (&dquot->dq_count));#endif spin_lock (&dq_list_lock); -list_add (&dquot->dq_free, tofree_head);/* As dquot must have currently users it can't be on the free list... */ +/* As dquot must have currently users it can't be on +* the free list... */ +list_add (&dquot->dq_free, tofree_head);spin_unlock (&dq_list_lock);return 1 ; }
@@ -861,19 +888,22 @@ static int remove_inode_dquot_ref(struct inode *inode, int type,return 0 ; } -/* Free list of dquots - called from inode.c */ -/* dquots are removed from inodes, no new references can be got so we are the only ones holding reference */ +/* +* Free list of dquots +* Dquots are removed from inodes and no new references can be got so we are +* the only ones holding reference +*/ static void put_dquot_list (struct list_head *tofree_head) {struct list_head *act_head;struct dquot *dquot; act_head = tofree_head->next; -/* So now we have dquots on the list... Just free them */ while (act_head != tofree_head) { dquot = list_entry(act_head, struct dquot, dq_free); act_head = act_head->next; -list_del_init (&dquot->dq_free);/* Remove dquot from the list so we won't have problems... */ +/* Remove dquot from the list so we won't have problems... */ +list_del_init (&dquot->dq_free);dqput (dquot); } }
@@ -1131,37 +1161,42 @@ static int ignore_hardlimit(struct dquot *dquot)struct mem_dqinfo *info = &sb_dqopt (dquot->dq_sb)->info[dquot->dq_type];return capable (CAP_SYS_RESOURCE ) && - (info->dqi_format->qf_fmt_id !=QFMT_VFS_OLD || !(info->dqi_flags &V1_DQF_RSQUASH )); + (info->dqi_format->qf_fmt_id !=QFMT_VFS_OLD || + !(info->dqi_flags &V1_DQF_RSQUASH )); }/* needs dq_data_lock */ static int check_idq (struct dquot *dquot,qsize_t inodes,char *warntype) { +qsize_t newinodes = dquot->dq_dqb.dqb_curinodes + inodes; + *warntype =QUOTA_NL_NOWARN ;if (!sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type) ||test_bit (DQ_FAKE_B , &dquot->dq_flags))return QUOTA_OK ;if (dquot->dq_dqb.dqb_ihardlimit && - (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_ihardlimit && + newinodes > dquot->dq_dqb.dqb_ihardlimit && !ignore_hardlimit (dquot)) { *warntype =QUOTA_NL_IHARDWARN ;return NO_QUOTA ; }if (dquot->dq_dqb.dqb_isoftlimit && - (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit && - dquot->dq_dqb.dqb_itime &&get_seconds () >= dquot->dq_dqb.dqb_itime && + newinodes > dquot->dq_dqb.dqb_isoftlimit && + dquot->dq_dqb.dqb_itime && +get_seconds () >= dquot->dq_dqb.dqb_itime && !ignore_hardlimit (dquot)) { *warntype =QUOTA_NL_ISOFTLONGWARN ;return NO_QUOTA ; }if (dquot->dq_dqb.dqb_isoftlimit && - (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit && + newinodes > dquot->dq_dqb.dqb_isoftlimit && dquot->dq_dqb.dqb_itime ==0 ) { *warntype =QUOTA_NL_ISOFTWARN ; - dquot->dq_dqb.dqb_itime =get_seconds () +sb_dqopt (dquot->dq_sb)->info[dquot->dq_type].dqi_igrace; + dquot->dq_dqb.dqb_itime =get_seconds () + +sb_dqopt (dquot->dq_sb)->info[dquot->dq_type].dqi_igrace; }return QUOTA_OK ;
@@ -1171,9 +1206,10 @@ static int check_idq(struct dquot *dquot, qsize_t inodes, char *warntype)static int check_bdq (struct dquot *dquot,qsize_t space,int prealloc,char *warntype) {qsize_t tspace; +struct super_block *sb = dquot->dq_sb; *warntype =QUOTA_NL_NOWARN ; -if (!sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type) || +if (!sb_has_quota_limits_enabled (sb, dquot->dq_type) ||test_bit (DQ_FAKE_B , &dquot->dq_flags))return QUOTA_OK ;
@@ -1190,7 +1226,8 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *warif (dquot->dq_dqb.dqb_bsoftlimit && tspace > dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_btime &&get_seconds () >= dquot->dq_dqb.dqb_btime && + dquot->dq_dqb.dqb_btime && +get_seconds () >= dquot->dq_dqb.dqb_btime && !ignore_hardlimit (dquot)) {if (!prealloc) *warntype =QUOTA_NL_BSOFTLONGWARN ;
@@ -1202,7 +1239,8 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war dquot->dq_dqb.dqb_btime == 0) {if (!prealloc) { *warntype =QUOTA_NL_BSOFTWARN ; - dquot->dq_dqb.dqb_btime =get_seconds () +sb_dqopt (dquot->dq_sb)->info[dquot->dq_type].dqi_bgrace; + dquot->dq_dqb.dqb_btime =get_seconds () + +sb_dqopt (sb)->info[dquot->dq_type].dqi_bgrace; }else /*
@@ -1217,15 +1255,18 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *warstatic int info_idq_free (struct dquot *dquot,qsize_t inodes) { +qsize_t newinodes; +if (test_bit (DQ_FAKE_B , &dquot->dq_flags) || dquot->dq_dqb.dqb_curinodes <= dquot->dq_dqb.dqb_isoftlimit || !sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type))return QUOTA_NL_NOWARN ; -if (dquot->dq_dqb.dqb_curinodes - inodes <= dquot->dq_dqb.dqb_isoftlimit) + newinodes = dquot->dq_dqb.dqb_curinodes - inodes; +if (newinodes <= dquot->dq_dqb.dqb_isoftlimit)return QUOTA_NL_ISOFTBELOW ;if (dquot->dq_dqb.dqb_curinodes >= dquot->dq_dqb.dqb_ihardlimit && - dquot->dq_dqb.dqb_curinodes - inodes < dquot->dq_dqb.dqb_ihardlimit) + newinodes < dquot->dq_dqb.dqb_ihardlimit)return QUOTA_NL_IHARDBELOW ;return QUOTA_NL_NOWARN ; }
@@ -1466,7 +1507,8 @@ int dquot_alloc_inode(const struct inode *inode, qsize_t number)for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (!inode->i_dquot[cnt])continue ; -if (check_idq (inode->i_dquot[cnt], number, warntype+cnt) ==NO_QUOTA ) +if (check_idq (inode->i_dquot[cnt], number, warntype+cnt) + ==NO_QUOTA ) goto warn_put_all; }
@@ -1673,19 +1715,11 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr) transfer_from[cnt] =NULL ; transfer_to[cnt] =NULL ; warntype_to[cnt] =QUOTA_NL_NOWARN ; -switch (cnt) { -case USRQUOTA : -if (!chuid) -continue ; - transfer_to[cnt] =dqget (inode->i_sb, iattr->ia_uid, cnt); -break ; -case GRPQUOTA : -if (!chgid) -continue ; - transfer_to[cnt] =dqget (inode->i_sb, iattr->ia_gid, cnt); -break ; - } } +if (chuid) + transfer_to[USRQUOTA ] =dqget (inode->i_sb, iattr->ia_uid, cnt); +if (chgid) + transfer_to[GRPQUOTA ] =dqget (inode->i_sb, iattr->ia_gid, cnt);down_write (&sb_dqopt (inode->i_sb)->dqptr_sem);/* Now recheck reliably when holding dqptr_sem */
@@ -1881,8 +1915,8 @@ int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags)drop_dquot_ref (sb, cnt);invalidate_dquots (sb, cnt);/* -* Now all dquots should be invalidated, all writes done so we should be only -* users of the info. No locks needed. +* Now all dquots should be invalidated, all writes done so we +* should be only users of the info. No locks needed. */ if (info_dirty (&dqopt->info[cnt])) sb->dq_op->write_info (sb, cnt);
@@ -1920,10 +1954,12 @@ int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags)/* If quota was reenabled in the meantime, we have * nothing to do */ if (!sb_has_quota_loaded (sb, cnt)) { -mutex_lock_nested (&toputinode[cnt]->i_mutex,I_MUTEX_QUOTA ); +mutex_lock_nested (&toputinode[cnt]->i_mutex, +I_MUTEX_QUOTA ); toputinode[cnt]->i_flags &= ~(S_IMMUTABLE |S_NOATIME |S_NOQUOTA ); -truncate_inode_pages (&toputinode[cnt]->i_data,0 ); +truncate_inode_pages (&toputinode[cnt]->i_data, +0 );mutex_unlock (&toputinode[cnt]->i_mutex);mark_inode_dirty (toputinode[cnt]); }
@@ -2013,7 +2049,8 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,* possible) Also nobody should write to the file - we use * special IO operations which ignore the immutable bit. */ down_write (&dqopt->dqptr_sem); - oldflags = inode->i_flags & (S_NOATIME |S_IMMUTABLE |S_NOQUOTA ); + oldflags = inode->i_flags & (S_NOATIME |S_IMMUTABLE | +S_NOQUOTA ); inode->i_flags |=S_NOQUOTA |S_NOATIME |S_IMMUTABLE ;up_write (&dqopt->dqptr_sem); sb->dq_op->drop (inode);
@@ -2032,7 +2069,8 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, dqopt->info[type].dqi_fmt_id = format_id;INIT_LIST_HEAD (&dqopt->info[type].dqi_dirty_list);mutex_lock (&dqopt->dqio_mutex); -if ((error = dqopt->ops[type]->read_file_info (sb, type)) <0 ) { + error = dqopt->ops[type]->read_file_info (sb, type); +if (error <0 ) {mutex_unlock (&dqopt->dqio_mutex); goto out_file_init; }
@@ -2254,7 +2292,8 @@ static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di)spin_unlock (&dq_data_lock); } -int vfs_get_dqblk (struct super_block *sb,int type,qid_t id,struct if_dqblk *di) +int vfs_get_dqblk (struct super_block *sb,int type,qid_t id, +struct if_dqblk *di) {struct dquot *dquot;
@@ -2318,22 +2357,25 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) }if (check_blim) { -if (!dm->dqb_bsoftlimit || dm->dqb_curspace < dm->dqb_bsoftlimit) { +if (!dm->dqb_bsoftlimit || + dm->dqb_curspace < dm->dqb_bsoftlimit) { dm->dqb_btime =0 ;clear_bit (DQ_BLKS_B , &dquot->dq_flags); - } -else if (!(di->dqb_valid &QIF_BTIME ))/* Set grace only if user hasn't provided his own... */ + }else if (!(di->dqb_valid &QIF_BTIME )) +/* Set grace only if user hasn't provided his own... */ dm->dqb_btime =get_seconds () + dqi->dqi_bgrace; }if (check_ilim) { -if (!dm->dqb_isoftlimit || dm->dqb_curinodes < dm->dqb_isoftlimit) { +if (!dm->dqb_isoftlimit || + dm->dqb_curinodes < dm->dqb_isoftlimit) { dm->dqb_itime =0 ;clear_bit (DQ_INODES_B , &dquot->dq_flags); - } -else if (!(di->dqb_valid &QIF_ITIME ))/* Set grace only if user hasn't provided his own... */ + }else if (!(di->dqb_valid &QIF_ITIME )) +/* Set grace only if user hasn't provided his own... */ dm->dqb_itime =get_seconds () + dqi->dqi_igrace; } -if (dm->dqb_bhardlimit || dm->dqb_bsoftlimit || dm->dqb_ihardlimit || dm->dqb_isoftlimit) +if (dm->dqb_bhardlimit || dm->dqb_bsoftlimit || dm->dqb_ihardlimit || + dm->dqb_isoftlimit)clear_bit (DQ_FAKE_B , &dquot->dq_flags);else set_bit (DQ_FAKE_B , &dquot->dq_flags);
@@ -2343,7 +2385,8 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di)return 0 ; } -int vfs_set_dqblk (struct super_block *sb,int type,qid_t id,struct if_dqblk *di) +int vfs_set_dqblk (struct super_block *sb,int type,qid_t id, +struct if_dqblk *di) {struct dquot *dquot;int rc;
@@ -2400,7 +2443,8 @@ int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)if (ii->dqi_valid &IIF_IGRACE ) mi->dqi_igrace = ii->dqi_igrace;if (ii->dqi_valid &IIF_FLAGS ) - mi->dqi_flags = (mi->dqi_flags & ~DQF_MASK ) | (ii->dqi_flags &DQF_MASK ); + mi->dqi_flags = (mi->dqi_flags & ~DQF_MASK ) | + (ii->dqi_flags &DQF_MASK );spin_unlock (&dq_data_lock);mark_info_dirty (sb, type);/* Force write to disk */
@@ -2559,7 +2603,8 @@ static int __init dquot_init(void)#ifdef CONFIG_QUOTA_NETLINK_INTERFACE if (genl_register_family ("a_genl_family) !=0 ) -printk (KERN_ERR "VFS: Failed to create quota netlink interface.\n" ); +printk (KERN_ERR +"VFS: Failed to create quota netlink interface.\n" );#endif return 0 ;
fs/quota/quota.c +23 -12
@@ -20,7 +20,8 @@#include <linux/types.h> /* Check validity of generic quotactl commands */ -static int generic_quotactl_valid (struct super_block *sb,int type,int cmd,qid_t id) +static int generic_quotactl_valid (struct super_block *sb,int type,int cmd, +qid_t id) {if (type >=MAXQUOTAS )return -EINVAL ;
@@ -72,7 +73,8 @@ static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qidcase Q_SETINFO :case Q_SETQUOTA :case Q_GETQUOTA : -/* This is just informative test so we are satisfied without a lock */ +/* This is just an informative test so we are satisfied +* without the lock */ if (!sb_has_quota_active (sb, type))return -ESRCH ; }
@@ -92,7 +94,8 @@ static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qid }/* Check validity of XFS Quota Manager commands */ -static int xqm_quotactl_valid (struct super_block *sb,int type,int cmd,qid_t id) +static int xqm_quotactl_valid (struct super_block *sb,int type,int cmd, +qid_t id) {if (type >=XQM_MAXQUOTAS )return -EINVAL ;
@@ -142,7 +145,8 @@ static int xqm_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t ireturn 0 ; } -static int check_quotactl_valid (struct super_block *sb,int type,int cmd,qid_t id) +static int check_quotactl_valid (struct super_block *sb,int type,int cmd, +qid_t id) {int error;
@@ -180,7 +184,8 @@ static void quota_sync_sb(struct super_block *sb, int type)continue ;if (!sb_has_quota_active (sb, cnt))continue ; -mutex_lock_nested (&sb_dqopt (sb)->files[cnt]->i_mutex,I_MUTEX_QUOTA ); +mutex_lock_nested (&sb_dqopt (sb)->files[cnt]->i_mutex, +I_MUTEX_QUOTA );truncate_inode_pages (&sb_dqopt (sb)->files[cnt]->i_data,0 );mutex_unlock (&sb_dqopt (sb)->files[cnt]->i_mutex); }
@@ -200,14 +205,15 @@ void sync_dquots(struct super_block *sb, int type)spin_lock (&sb_lock); restart:list_for_each_entry (sb, &super_blocks, s_list) { -/* This test just improves performance so it needn't be reliable... */ +/* This test just improves performance so it needn't be +* reliable... */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (type !=-1 && type != cnt)continue ;if (!sb_has_quota_active (sb, cnt))continue ;if (!info_dirty (&sb_dqopt (sb)->info[cnt]) && -list_empty (&sb_dqopt (sb)->info[cnt].dqi_dirty_list)) +list_empty (&sb_dqopt (sb)->info[cnt].dqi_dirty_list))continue ;break ; }
@@ -227,7 +233,8 @@ restart: }/* Copy parameters and call proper function */ -static int do_quotactl (struct super_block *sb,int type,int cmd,qid_t id,void __user *addr) +static int do_quotactl (struct super_block *sb,int type,int cmd,qid_t id, +void __user *addr) {int ret;
@@ -235,7 +242,8 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, voidcase Q_QUOTAON : {char *pathname; -if (IS_ERR (pathname =getname (addr))) + pathname =getname (addr); +if (IS_ERR (pathname))return PTR_ERR (pathname); ret = sb->s_qcop->quota_on (sb, type, id, pathname,0 );putname (pathname);
@@ -261,7 +269,8 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, voidcase Q_GETINFO : {struct if_dqinfo info; -if ((ret = sb->s_qcop->get_info (sb, type, &info))) + ret = sb->s_qcop->get_info (sb, type, &info); +if (ret)return ret;if (copy_to_user (addr, &info,sizeof (info)))return -EFAULT ;
@@ -277,7 +286,8 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, voidcase Q_GETQUOTA : {struct if_dqblk idq; -if ((ret = sb->s_qcop->get_dqblk (sb, type, id, &idq))) + ret = sb->s_qcop->get_dqblk (sb, type, id, &idq); +if (ret)return ret;if (copy_to_user (addr, &idq,sizeof (idq)))return -EFAULT ;
@@ -322,7 +332,8 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, voidcase Q_XGETQUOTA : {struct fs_disk_quota fdq; -if ((ret = sb->s_qcop->get_xquota (sb, type, id, &fdq))) + ret = sb->s_qcop->get_xquota (sb, type, id, &fdq); +if (ret)return ret;if (copy_to_user (addr, &fdq,sizeof (fdq)))return -EFAULT ;
fs/quota/quota_tree.c +27 -15
96 lines not on this page · raw message
fs/quota/quota_v1.c +32 -16
94 lines not on this page · raw message
fs/quota/quota_v2.c +2 -1
@@ -54,7 +54,8 @@ static int v2_check_quota_file(struct super_block *sb, int type)static const uint quota_magics[] =V2_INITQMAGICS ;static const uint quota_versions[] =V2_INITQVERSIONS ; - size = sb->s_op->quota_read (sb, type, (char *)&dqhead,sizeof (struct v2_disk_dqheader ),0 ); + size = sb->s_op->quota_read (sb, type, (char *)&dqhead, +sizeof (struct v2_disk_dqheader ),0 );if (size !=sizeof (struct v2_disk_dqheader )) {printk ("quota_v2: failed read expected=%zd got=%zd\n" ,sizeof (struct v2_disk_dqheader ), size);
Signature · 1 line
1.6.0.2
Re: [PATCH 05/16] vfs: Use lowercase names of quota functions
In reply to Jan KaraQuoted 1 line · Jan Kara
Use lowercase names of quota functions instead of old uppercase ones.
Looking over this again I think the vfs_ names are a really bad choice. The normal use for vfs_ are higher level functions that call into specific filesystems, which these aren't really. What about just striping out that vfs_ prefix first?
Jan Kara
reviewerRe: [PATCH 05/16] vfs: Use lowercase names of quota functions
Quoted 7 lines · Christoph Hellwig
Quoted 1 line · Jan Kara
Use lowercase names of quota functions instead of old uppercase ones.
Looking over this again I think the
vfs_names are a really bad choice. The normal use forvfs_are higher level functions that call into specific filesystems, which these aren't really. What about just striping out thatvfs_prefix first?
Actually, these vfs_dq_ functions are usually just wrappers like:
static inline void vfs_dq_init(struct inode *inode)
{
BUG_ON(!inode->i_sb);
if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
inode->i_sb->dq_op->initialize(inode, -1);
} where ->initialize either leads to a filesystem specified callback or to
generic quota init function. So this seems to reasonably match your description above...
But if this still has not convinced you ;), I can change all these quota
functions to have names starting with dq_. That should not clash with anything else. But I'm not very enthusiastic about this change (cleanups are so boring...).
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 09/16] ext4: Use lowercase names of quota functions
In reply to Jan KaraLooks good to me.
Quoted 189 lines · 在 2009-01-27二的 17:48 +0100,Jan Kara写道:
Use lowercase names of quota functions instead of old uppercase ones.
Signed-off-by Jan Kara <[email protected]>--- fs/ext4/balloc.c | 2 +- fs/ext4/ialloc.c | 12 ++++++------ fs/ext4/inode.c | 4 ++-- fs/ext4/mballoc.c | 4 ++-- fs/ext4/namei.c | 6 +++--- fs/ext4/super.c | 6 +++--- fs/ext4/xattr.c | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-)fs/ext4/balloc.c +1
-1@@ -536,7 +536,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,ext4_mb_free_blocks (handle, inode, block, count, metadata, &dquot_freed_blocks);if (dquot_freed_blocks) -DQUOT_FREE_BLOCK (inode, dquot_freed_blocks); +vfs_dq_free_block (inode, dquot_freed_blocks);return ; }fs/ext4/ialloc.c +6
-6@@ -220,10 +220,10 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)* Note: we must free any quota before locking the superblock, * as writing the quota to disk may need the lock as well. */ -DQUOT_INIT (inode); +vfs_dq_init (inode);ext4_xattr_delete_inode (handle, inode); -DQUOT_FREE_INODE (inode); -DQUOT_DROP (inode); +vfs_dq_free_inode (inode); +vfs_dq_drop (inode); is_directory =S_ISDIR (inode->i_mode);@@ -904,7 +904,7 @@ got: ei->i_extra_isize =EXT4_SB (sb)->s_want_extra_isize; ret = inode; -if (DQUOT_ALLOC_INODE (inode)) { +if (vfs_dq_alloc_inode (inode)) { err = -EDQUOT ; goto fail_drop; }@@ -945,10 +945,10 @@ really_out:return ret; fail_free_drop: -DQUOT_FREE_INODE (inode); +vfs_dq_free_inode (inode); fail_drop: -DQUOT_DROP (inode); +vfs_dq_drop (inode); inode->i_flags |=S_NOQUOTA ; inode->i_nlink =0 ;unlock_new_inode (inode);fs/ext4/inode.c +2
-2@@ -4619,7 +4619,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) error =PTR_ERR (handle); goto err_out; } - error =DQUOT_TRANSFER (inode, attr) ? -EDQUOT :0 ; + error =vfs_dq_transfer (inode, attr) ? -EDQUOT :0 ;if (error) {ext4_journal_stop (handle);return error;@@ -4998,7 +4998,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)* i_size has been changed by generic_commit_write() and we thus need * to include the updated inode in the current transaction. * -* Also, DQUOT_ALLOC_SPACE() will always dirty the inode when blocks +* Also, vfs_dq_alloc_block() will always dirty the inode when blocks * are allocated to the file. * * If the inode is marked synchronous, we don't honour that here - doing fs/ext4/mballoc.c +2
-2@@ -4576,7 +4576,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,return 0 ; } reserv_blks = ar->len; -while (ar->len &&DQUOT_ALLOC_BLOCK (ar->inode, ar->len)) { +while (ar->len &&vfs_dq_alloc_block (ar->inode, ar->len)) { ar->flags |=EXT4_MB_HINT_NOPREALLOC ; ar->len--; }@@ -4652,7 +4652,7 @@ out2:kmem_cache_free (ext4_ac_cachep, ac); out1:if (inquota && ar->len < inquota) -DQUOT_FREE_BLOCK (ar->inode, inquota - ar->len); +vfs_dq_free_block (ar->inode, inquota - ar->len); out3:if (!ar->len) {if (!EXT4_I (ar->inode)->i_delalloc_reserved_flag)fs/ext4/namei.c +3
-3@@ -2083,7 +2083,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)/* Initialize quotas before so that eventual writes go in * separate transaction */ -DQUOT_INIT (dentry->d_inode); +vfs_dq_init (dentry->d_inode); handle =ext4_journal_start (dir,EXT4_DELETE_TRANS_BLOCKS (dir->i_sb));if (IS_ERR (handle))return PTR_ERR (handle);@@ -2142,7 +2142,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)/* Initialize quotas before so that eventual writes go * in separate transaction */ -DQUOT_INIT (dentry->d_inode); +vfs_dq_init (dentry->d_inode); handle =ext4_journal_start (dir,EXT4_DELETE_TRANS_BLOCKS (dir->i_sb));if (IS_ERR (handle))return PTR_ERR (handle);@@ -2309,7 +2309,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,/* Initialize quotas before so that eventual writes go * in separate transaction */ if (new_dentry->d_inode) -DQUOT_INIT (new_dentry->d_inode); +vfs_dq_init (new_dentry->d_inode); handle =ext4_journal_start (old_dir,2 *EXT4_DATA_TRANS_BLOCKS (old_dir->i_sb) +EXT4_INDEX_EXTRA_TRANS_BLOCKS +2 );fs/ext4/super.c +3
-3@@ -1804,7 +1804,7 @@ static void ext4_orphan_cleanup(struct super_block *sb, }list_add (&EXT4_I (inode)->i_orphan, &EXT4_SB (sb)->s_orphan); -DQUOT_INIT (inode); +vfs_dq_init (inode);if (inode->i_nlink) { printk(KERN_DEBUG "%s: truncating inode %lu to %lld bytes\n",@@ -3367,8 +3367,8 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)* is locked for write. Otherwise the are possible deadlocks: * Process 1 Process 2 * ext4_create() quota_sync() -* jbd2_journal_start() write_dquot() -* DQUOT_INIT() down(dqio_mutex) +* jbd2_journal_start() write_dquot() +* vfs_dq_init() down(dqio_mutex) * down(dqio_mutex) jbd2_journal_start() * */ fs/ext4/xattr.c +2
-2@@ -490,7 +490,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode, error =ext4_handle_dirty_metadata (handle, inode, bh);if (IS_SYNC (inode))ext4_handle_sync (handle); -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 );ea_bdebug (bh,"refcount now=%d; releasing" ,le32_to_cpu (BHDR (bh)->h_refcount));if (ce)@@ -784,7 +784,7 @@ inserted:/* The old block is released after updating the inode. */ error = -EDQUOT ; -if (DQUOT_ALLOC_BLOCK (inode,1 )) +if (vfs_dq_alloc_block (inode,1 )) goto cleanup; error =ext4_journal_get_write_access (handle, new_bh);
fs/ext4/xattr.c cleanup: · line 866
Quoted 8 lines
fs/ext4/xattr.c +1
-1@@ -860,7 +860,7 @@ cleanup:return error; cleanup_dquot: -DQUOT_FREE_BLOCK (inode,1 ); +vfs_dq_free_block (inode,1 ); goto cleanup; bad_block:
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/16] vfs: Use lowercase names of quota functions
In reply to Jan KaraQuoted 17 lines · Jan Kara
Quoted 7 lines · Christoph Hellwig
Quoted 1 line · Jan Kara
Use lowercase names of quota functions instead of old uppercase ones.
Looking over this again I think the
vfs_names are a really bad choice. The normal use forvfs_are higher level functions that call into specific filesystems, which these aren't really. What about just striping out thatvfs_prefix first?Actually, these
vfs_dq_functions are usually just wrappers like:static inline void
vfs_dq_init(struct inode *inode){ BUG_ON(!inode->i_sb); if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) inode->i_sb->dq_op->initialize(inode, -1); }
Quoted 7 lines
where ->initialize either leads to a filesystem specified callback or to
generic quota init function. So this seems to reasonably match your description above...
But if this still has not convinced you ;), I can change all these quota
functions to have names starting withdq_. That should not clash with anything else. But I'm not very enthusiastic about this change (cleanups are so boring...).
Hmm, seems you're right - I must have been confused when looking at it.
Changing away from the weird uppercase names defintively is a good thing.
Although for the ops inside the filesystem it might be better to just call into the lowlevel operation instead of the vfs_ helper as we know what we want, no?
Jan Kara
reviewerRe: [PATCH 05/16] vfs: Use lowercase names of quota functions
Quoted 26 lines · Christoph Hellwig
Quoted 17 lines · Jan Kara
Quoted 7 lines · Christoph Hellwig
Quoted 1 line · Jan Kara
Use lowercase names of quota functions instead of old uppercase ones.
Looking over this again I think the
vfs_names are a really bad choice. The normal use forvfs_are higher level functions that call into specific filesystems, which these aren't really. What about just striping out thatvfs_prefix first?Actually, these
vfs_dq_functions are usually just wrappers like:static inline void
vfs_dq_init(struct inode *inode){ BUG_ON(!inode->i_sb); if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) inode->i_sb->dq_op->initialize(inode, -1); }Quoted 7 lines
where ->initialize either leads to a filesystem specified callback or to
generic quota init function. So this seems to reasonably match your description above...
But if this still has not convinced you ;), I can change all these quota
functions to have names starting withdq_. That should not clash with anything else. But I'm not very enthusiastic about this change (cleanups are so boring...).
Quoted 8 lines
Hmm, seems you're right - I must have been confused when looking at it.
Changing away from the weird uppercase names defintively is a good thing.
Although for the ops inside the filesystem it might be better to just call into the lowlevel operation instead of the
vfs_helper as we know what we want, no?
Yes, filesystem knows what it wants but the vfs_ helpers are there so that
every filesystem does not have to implement the same checks (usually checking whether quota is enabled etc)...
Honza
Re: [PATCH 13/16] jfs: Use lowercase names of quota functions
In reply to Jan KaraQuoted 3 lines · Jan Kara
Use lowercase names of quota functions instead of old uppercase ones.
Signed-off-by Jan Kara <[email protected]>
Quoted 342 lines
--- fs/jfs/acl.c | 2 +- fs/jfs/inode.c | 6 +++--- fs/jfs/jfs_dtree.c | 18 +++++++++--------- fs/jfs/jfs_extent.c | 10 +++++----- fs/jfs/jfs_inode.c | 4 ++-- fs/jfs/jfs_xtree.c | 14 +++++++------- fs/jfs/namei.c | 6 +++--- fs/jfs/xattr.c | 12 ++++++------ 8 files changed, 36 insertions(+), 36 deletions(-)fs/jfs/acl.c +1
-1@@ -233,7 +233,7 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)if ((iattr->ia_valid &ATTR_UID && iattr->ia_uid != inode->i_uid) || (iattr->ia_valid &ATTR_GID && iattr->ia_gid != inode->i_gid)) { -if (DQUOT_TRANSFER (inode, iattr)) +if (vfs_dq_transfer (inode, iattr))return -EDQUOT ; }fs/jfs/inode.c +3
-3@@ -158,9 +158,9 @@ void jfs_delete_inode(struct inode *inode)/* * Free the inode from the quota allocation. */ -DQUOT_INIT (inode); -DQUOT_FREE_INODE (inode); -DQUOT_DROP (inode); +vfs_dq_init (inode); +vfs_dq_free_inode (inode); +vfs_dq_drop (inode); }clear_inode (inode);fs/jfs/jfs_dtree.c +9
-9@@ -381,10 +381,10 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)* It's time to move the inline table to an external * page and begin to build the xtree */ -if (DQUOT_ALLOC_BLOCK (ip, sbi->nbperpage)) +if (vfs_dq_alloc_block (ip, sbi->nbperpage)) goto clean_up;if (dbAlloc (ip,0 , sbi->nbperpage, &xaddr)) { -DQUOT_FREE_BLOCK (ip, sbi->nbperpage); +vfs_dq_free_block (ip, sbi->nbperpage); goto clean_up; }@@ -408,7 +408,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)memcpy (&jfs_ip->i_dirtable, temp_table,sizeof (temp_table));dbFree (ip, xaddr, sbi->nbperpage); -DQUOT_FREE_BLOCK (ip, sbi->nbperpage); +vfs_dq_free_block (ip, sbi->nbperpage); goto clean_up; } ip->i_size =PSIZE ;@@ -1027,7 +1027,7 @@ static int dtSplitUp(tid_t tid, n = xlen;/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip, n)) { +if (vfs_dq_alloc_block (ip, n)) { rc = -EDQUOT ; goto extendOut; }@@ -1308,7 +1308,7 @@ static int dtSplitUp(tid_t tid,/* Rollback quota allocation */ if (rc && quota_allocation) -DQUOT_FREE_BLOCK (ip, quota_allocation); +vfs_dq_free_block (ip, quota_allocation); dtSplitUp_Exit:@@ -1369,7 +1369,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,return -EIO ;/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip,lengthPXD (pxd))) { +if (vfs_dq_alloc_block (ip,lengthPXD (pxd))) {release_metapage (rmp);return -EDQUOT ; }@@ -1916,7 +1916,7 @@ static int dtSplitRoot(tid_t tid, rp = rmp->data;/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip,lengthPXD (pxd))) { +if (vfs_dq_alloc_block (ip,lengthPXD (pxd))) {release_metapage (rmp);return -EDQUOT ; }@@ -2287,7 +2287,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip, xlen =lengthPXD (&fp->header.self);/* Free quota allocation. */ -DQUOT_FREE_BLOCK (ip, xlen); +vfs_dq_free_block (ip, xlen);/* free/invalidate its buffer page */ discard_metapage (fmp);@@ -2363,7 +2363,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip, xlen =lengthPXD (&p->header.self);/* Free quota allocation */ -DQUOT_FREE_BLOCK (ip, xlen); +vfs_dq_free_block (ip, xlen);/* free/invalidate its buffer page */ discard_metapage (mp);fs/jfs/jfs_extent.c +5
-5@@ -141,7 +141,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) }/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip, nxlen)) { +if (vfs_dq_alloc_block (ip, nxlen)) {dbFree (ip, nxaddr, (s64 ) nxlen);mutex_unlock (&JFS_IP (ip)->commit_mutex);return -EDQUOT ;@@ -164,7 +164,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr)*/ if (rc) {dbFree (ip, nxaddr, nxlen); -DQUOT_FREE_BLOCK (ip, nxlen); +vfs_dq_free_block (ip, nxlen);mutex_unlock (&JFS_IP (ip)->commit_mutex);return (rc); }@@ -256,7 +256,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr) goto exit;/* Allocat blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip, nxlen)) { +if (vfs_dq_alloc_block (ip, nxlen)) {dbFree (ip, nxaddr, (s64 ) nxlen);mutex_unlock (&JFS_IP (ip)->commit_mutex);return -EDQUOT ;@@ -297,7 +297,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)/* extend the extent */ if ((rc =xtExtend (0 , ip, xoff + xlen, (int ) nextend,0 ))) {dbFree (ip, xaddr + xlen, delta); -DQUOT_FREE_BLOCK (ip, nxlen); +vfs_dq_free_block (ip, nxlen); goto exit; } }else {@@ -308,7 +308,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)*/ if ((rc =xtTailgate (0 , ip, xoff, (int ) ntail, nxaddr,0 ))) {dbFree (ip, nxaddr, nxlen); -DQUOT_FREE_BLOCK (ip, nxlen); +vfs_dq_free_block (ip, nxlen); goto exit; } }fs/jfs/jfs_inode.c +2
-2@@ -116,7 +116,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)/* * Allocate inode to quota. */ -if (DQUOT_ALLOC_INODE (inode)) { +if (vfs_dq_alloc_inode (inode)) { rc = -EDQUOT ; goto fail_drop; }@@ -162,7 +162,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)return inode; fail_drop: -DQUOT_DROP (inode); +vfs_dq_drop (inode); inode->i_flags |=S_NOQUOTA ; fail_unlock: inode->i_nlink =0 ;fs/jfs/jfs_xtree.c +7
-7@@ -846,10 +846,10 @@ int xtInsert(tid_t tid, /* transaction id */ hint =addressXAD (xad) +lengthXAD (xad) -1 ; }else hint =0 ; -if ((rc =DQUOT_ALLOC_BLOCK (ip, xlen))) +if ((rc =vfs_dq_alloc_block (ip, xlen))) goto out;if ((rc =dbAlloc (ip, hint, (s64 ) xlen, &xaddr))) { -DQUOT_FREE_BLOCK (ip, xlen); +vfs_dq_free_block (ip, xlen); goto out; } }@@ -878,7 +878,7 @@ int xtInsert(tid_t tid, /* transaction id *//* undo data extent allocation */ if (*xaddrp ==0 ) {dbFree (ip, xaddr, (s64 ) xlen); -DQUOT_FREE_BLOCK (ip, xlen); +vfs_dq_free_block (ip, xlen); }return rc; }@@ -1246,7 +1246,7 @@ xtSplitPage(tid_t tid, struct inode *ip, rbn =addressPXD (pxd);/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip,lengthPXD (pxd))) { +if (vfs_dq_alloc_block (ip,lengthPXD (pxd))) { rc = -EDQUOT ; goto clean_up; }@@ -1456,7 +1456,7 @@ xtSplitPage(tid_t tid, struct inode *ip,/* Rollback quota allocation. */ if (quota_allocation) -DQUOT_FREE_BLOCK (ip, quota_allocation); +vfs_dq_free_block (ip, quota_allocation);return (rc); }@@ -1513,7 +1513,7 @@ xtSplitRoot(tid_t tid,return -EIO ;/* Allocate blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip,lengthPXD (pxd))) { +if (vfs_dq_alloc_block (ip,lengthPXD (pxd))) {release_metapage (rmp);return -EDQUOT ; }@@ -3941,7 +3941,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) ip->i_size = newsize;/* update quota allocation to reflect freed blocks */ -DQUOT_FREE_BLOCK (ip, nfreed); +vfs_dq_free_block (ip, nfreed);/* * free tlock of invalidated pages fs/jfs/namei.c +3
-3@@ -356,7 +356,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)jfs_info ("jfs_rmdir: dip:0x%p name:%s" , dip, dentry->d_name.name);/* Init inode for quota operations. */ -DQUOT_INIT (ip); +vfs_dq_init (ip);/* directory must be empty to be removed */ if (!dtEmpty (ip)) {@@ -483,7 +483,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)jfs_info ("jfs_unlink: dip:0x%p name:%s" , dip, dentry->d_name.name);/* Init inode for quota operations. */ -DQUOT_INIT (ip); +vfs_dq_init (ip);if ((rc =get_UCSname (&dname, dentry))) goto out;@@ -1136,7 +1136,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, }else if (new_ip) {IWRITE_LOCK (new_ip,RDWRLOCK_NORMAL );/* Init inode for quota operations. */ -DQUOT_INIT (new_ip); +vfs_dq_init (new_ip); }/* fs/jfs/xattr.c +6
-6@@ -260,14 +260,14 @@ static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size, nblocks = (size + (sb->s_blocksize -1 )) >> sb->s_blocksize_bits;/* Allocate new blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (ip, nblocks)) { +if (vfs_dq_alloc_block (ip, nblocks)) {return -EDQUOT ; } rc =dbAlloc (ip,INOHINT (ip), nblocks, &blkno);if (rc) {/*Rollback quota allocation. */ -DQUOT_FREE_BLOCK (ip, nblocks); +vfs_dq_free_block (ip, nblocks);return rc; }@@ -332,7 +332,7 @@ static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size, failed:/* Rollback quota allocation. */ -DQUOT_FREE_BLOCK (ip, nblocks); +vfs_dq_free_block (ip, nblocks);dbFree (ip, blkno, nblocks);return rc;@@ -538,7 +538,7 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)if (blocks_needed > current_blocks) {/* Allocate new blocks to quota. */ -if (DQUOT_ALLOC_BLOCK (inode, blocks_needed)) +if (vfs_dq_alloc_block (inode, blocks_needed))return -EDQUOT ; quota_allocation = blocks_needed;@@ -602,7 +602,7 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size) clean_up:/* Rollback quota allocation */ if (quota_allocation) -DQUOT_FREE_BLOCK (inode, quota_allocation); +vfs_dq_free_block (inode, quota_allocation);return (rc); }@@ -677,7 +677,7 @@ static int ea_put(tid_t tid, struct inode *inode, struct ea_buffer *ea_buf,/* If old blocks exist, they must be removed from quota allocation. */ if (old_blocks) -DQUOT_FREE_BLOCK (inode, old_blocks); +vfs_dq_free_block (inode, old_blocks); inode->i_ctime =CURRENT_TIME ;
Signature · 2 lines
David Kleikamp IBM Linux Technology Center