Skip to content

Commit 2ebc736

Browse files
ottingergjankara
authored andcommitted
ext2: improve consistency of ext2_fsblk_t datatype usage
The ext2 block allocation/deallocation functions and their respective calls use a mixture of unsigned long and ext2_fsblk_t datatypes to index the desired ext2 block. This commit replaces occurrences of unsigned long with ext2_fsblk_t, covering the functions ext2_new_block(), ext2_new_blocks(), ext2_free_blocks(), ext2_free_data() and ext2_free_branches(). This commit is rather conservative, and only replaces unsigned long with ext2_fsblk_t if the variable is used to index a specific ext2 block. Signed-off-by: Georg Ottinger <g.ottinger@gmx.at> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20230817195925.10268-1-g.ottinger@gmx.at>
1 parent 9bc6fc3 commit 2ebc736

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

fs/ext2/balloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ void ext2_discard_reservation(struct inode *inode)
474474
* @block: start physical block to free
475475
* @count: number of blocks to free
476476
*/
477-
void ext2_free_blocks (struct inode * inode, unsigned long block,
478-
unsigned long count)
477+
void ext2_free_blocks(struct inode * inode, ext2_fsblk_t block,
478+
unsigned long count)
479479
{
480480
struct buffer_head *bitmap_bh = NULL;
481481
struct buffer_head * bh2;

fs/ext2/ext2.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,12 +701,11 @@ static inline struct ext2_inode_info *EXT2_I(struct inode *inode)
701701
/* balloc.c */
702702
extern int ext2_bg_has_super(struct super_block *sb, int group);
703703
extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
704-
extern ext2_fsblk_t ext2_new_blocks(struct inode *, unsigned long,
704+
extern ext2_fsblk_t ext2_new_blocks(struct inode *, ext2_fsblk_t,
705705
unsigned long *, int *, unsigned int);
706706
extern int ext2_data_block_valid(struct ext2_sb_info *sbi, ext2_fsblk_t start_blk,
707707
unsigned int count);
708-
extern void ext2_free_blocks (struct inode *, unsigned long,
709-
unsigned long);
708+
extern void ext2_free_blocks(struct inode *, ext2_fsblk_t, unsigned long);
710709
extern unsigned long ext2_count_free_blocks (struct super_block *);
711710
extern unsigned long ext2_count_dirs (struct super_block *);
712711
extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,

fs/ext2/inode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,8 +1082,8 @@ static Indirect *ext2_find_shared(struct inode *inode,
10821082
*/
10831083
static inline void ext2_free_data(struct inode *inode, __le32 *p, __le32 *q)
10841084
{
1085-
unsigned long block_to_free = 0, count = 0;
1086-
unsigned long nr;
1085+
ext2_fsblk_t block_to_free = 0, count = 0;
1086+
ext2_fsblk_t nr;
10871087

10881088
for ( ; p < q ; p++) {
10891089
nr = le32_to_cpu(*p);
@@ -1123,7 +1123,7 @@ static inline void ext2_free_data(struct inode *inode, __le32 *p, __le32 *q)
11231123
static void ext2_free_branches(struct inode *inode, __le32 *p, __le32 *q, int depth)
11241124
{
11251125
struct buffer_head * bh;
1126-
unsigned long nr;
1126+
ext2_fsblk_t nr;
11271127

11281128
if (depth--) {
11291129
int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb);

0 commit comments

Comments
 (0)