mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fat: instead of constant number, use the i_blkbits of struct inode to calculate the number of blocks
@ 2013-02-19 11:50 Hyeoncheol Lee
  2013-02-19 11:56 ` OGAWA Hirofumi
  0 siblings, 1 reply; 2+ messages in thread
From: Hyeoncheol Lee @ 2013-02-19 11:50 UTC (permalink / raw)
  To: hirofumi; +Cc: linux-kernel, linux-fsdevel

To calculate the number of blocks from the number of clusters,
use the i_blkbits of struct inode instead of 9.

Signed-off-by: Hyeoncheol Lee <hyc.lee@gmail.com>
---
 fs/fat/misc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 6d93360..ccdf663 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -156,7 +156,7 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster)
 			     (llu)(inode->i_blocks >> (sbi->cluster_bits - 9)));
 		fat_cache_inval_inode(inode);
 	}
-	inode->i_blocks += nr_cluster << (sbi->cluster_bits - 9);
+	inode->i_blocks += nr_cluster << (sbi->cluster_bits - inode->i_blkbits);
 
 	return 0;
 }
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fat: instead of constant number, use the i_blkbits of struct inode to calculate the number of blocks
  2013-02-19 11:50 [PATCH] fat: instead of constant number, use the i_blkbits of struct inode to calculate the number of blocks Hyeoncheol Lee
@ 2013-02-19 11:56 ` OGAWA Hirofumi
  0 siblings, 0 replies; 2+ messages in thread
From: OGAWA Hirofumi @ 2013-02-19 11:56 UTC (permalink / raw)
  To: Hyeoncheol Lee; +Cc: linux-kernel, linux-fsdevel

Hyeoncheol Lee <hyc.lee@gmail.com> writes:

> To calculate the number of blocks from the number of clusters,
> use the i_blkbits of struct inode instead of 9.
>
> Signed-off-by: Hyeoncheol Lee <hyc.lee@gmail.com>
> ---
>  fs/fat/misc.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index 6d93360..ccdf663 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -156,7 +156,7 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster)
>  			     (llu)(inode->i_blocks >> (sbi->cluster_bits - 9)));
>  		fat_cache_inval_inode(inode);
>  	}
> -	inode->i_blocks += nr_cluster << (sbi->cluster_bits - 9);
> +	inode->i_blocks += nr_cluster << (sbi->cluster_bits - inode->i_blkbits);

No. Unit of ->i_blocks is 512bytes always. So, 9 is right number.

>  
>  	return 0;
>  }

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-19 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19 11:50 [PATCH] fat: instead of constant number, use the i_blkbits of struct inode to calculate the number of blocks Hyeoncheol Lee
2013-02-19 11:56 ` OGAWA Hirofumi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®