2008-12-12 20:48:06

by Mingming Cao

[permalink] [raw]
Subject: [PATCH V2 1/2] QUOTA cleanup: Use inode->i_blkbits to get block bits

quota: Use inode->i_blkbits to get block bits

From: Mingming Cao <[email protected]>

Andrew has suggested to use inode->i_blkbits to get the block bits info,
rather than use super block's blockbits. That should be faster and emit
less code.

Signed-off-by: Mingming Cao <[email protected]>
---
include/linux/quotaops.h | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)

Index: linux-2.6.28-rc2/include/linux/quotaops.h
===================================================================
--- linux-2.6.28-rc2.orig/include/linux/quotaops.h 2008-12-12 12:21:49.000000000 -0800
+++ linux-2.6.28-rc2/include/linux/quotaops.h 2008-12-12 12:32:21.000000000 -0800
@@ -398,39 +398,33 @@ static inline void vfs_dq_free_space(str

static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
{
- return vfs_dq_prealloc_space_nodirty(inode,
- nr << inode->i_sb->s_blocksize_bits);
+ return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits);
}

static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
{
- return vfs_dq_prealloc_space(inode,
- nr << inode->i_sb->s_blocksize_bits);
+ return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits);
}

static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
{
- return vfs_dq_alloc_space_nodirty(inode,
- nr << inode->i_sb->s_blocksize_bits);
+ return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits);
}


static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
{
- return vfs_dq_alloc_space(inode,
- nr << inode->i_sb->s_blocksize_bits);
+ return vfs_dq_alloc_space(inode, nr << inode->i_blkbits);
}

static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr)
{
- return vfs_dq_reserve_space(inode,
- nr << inode->i_blkbits);
+ return vfs_dq_reserve_space(inode, nr << inode->i_blkbits);
}

static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr)
{
- return vfs_dq_claim_space(inode,
- nr << inode->i_blkbits);
+ return vfs_dq_claim_space(inode, nr << inode->i_blkbits);
}

static inline
@@ -441,12 +435,12 @@ void vfs_dq_release_reservation_block(st

static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
{
- vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits);
+ vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits);
}

static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
{
- vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits);
+ vfs_dq_free_space(inode, nr << inode->i_blkbits);
}

/*




2008-12-15 12:42:44

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH V2 1/2] QUOTA cleanup: Use inode->i_blkbits to get block bits

On Fri 12-12-08 12:48:06, Mingming Cao wrote:
> quota: Use inode->i_blkbits to get block bits
>
> From: Mingming Cao <[email protected]>
>
> Andrew has suggested to use inode->i_blkbits to get the block bits info,
> rather than use super block's blockbits. That should be faster and emit
> less code.
>
> Signed-off-by: Mingming Cao <[email protected]>
Acked-by: Jan Kara <[email protected]>

Honza

> ---
> include/linux/quotaops.h | 22 ++++++++--------------
> 1 file changed, 8 insertions(+), 14 deletions(-)
>
> Index: linux-2.6.28-rc2/include/linux/quotaops.h
> ===================================================================
> --- linux-2.6.28-rc2.orig/include/linux/quotaops.h 2008-12-12 12:21:49.000000000 -0800
> +++ linux-2.6.28-rc2/include/linux/quotaops.h 2008-12-12 12:32:21.000000000 -0800
> @@ -398,39 +398,33 @@ static inline void vfs_dq_free_space(str
>
> static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
> {
> - return vfs_dq_prealloc_space_nodirty(inode,
> - nr << inode->i_sb->s_blocksize_bits);
> + return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits);
> }
>
> static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
> {
> - return vfs_dq_prealloc_space(inode,
> - nr << inode->i_sb->s_blocksize_bits);
> + return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits);
> }
>
> static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
> {
> - return vfs_dq_alloc_space_nodirty(inode,
> - nr << inode->i_sb->s_blocksize_bits);
> + return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits);
> }
>
>
> static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
> {
> - return vfs_dq_alloc_space(inode,
> - nr << inode->i_sb->s_blocksize_bits);
> + return vfs_dq_alloc_space(inode, nr << inode->i_blkbits);
> }
>
> static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr)
> {
> - return vfs_dq_reserve_space(inode,
> - nr << inode->i_blkbits);
> + return vfs_dq_reserve_space(inode, nr << inode->i_blkbits);
> }
>
> static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr)
> {
> - return vfs_dq_claim_space(inode,
> - nr << inode->i_blkbits);
> + return vfs_dq_claim_space(inode, nr << inode->i_blkbits);
> }
>
> static inline
> @@ -441,12 +435,12 @@ void vfs_dq_release_reservation_block(st
>
> static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
> {
> - vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits);
> + vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits);
> }
>
> static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
> {
> - vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits);
> + vfs_dq_free_space(inode, nr << inode->i_blkbits);
> }
>
> /*
>
>
--
Jan Kara <[email protected]>
SUSE Labs, CR