diff options
author | Bob Peterson <rpeterso@redhat.com> | 2014-08-06 09:08:36 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2014-08-21 05:22:23 -0400 |
commit | b650738cd093a9f9e9551db9ce5cd68acd842dc0 (patch) | |
tree | e7967f14957c8b42d7a8b03d9e6dfebeeba20d92 /fs/gfs2 | |
parent | eaebdedc61ac7bc3dd6ef6eb508097c4aaabef0c (diff) |
GFS2: Change maxlen variables to size_t
This patch changes some variables (especially maxlen in function
gfs2_block_map) from unsigned int to size_t. We need 64-bit arithmetic
for very large files (e.g. 1PB) where the variables otherwise get
shifted to all 0's.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/bmap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index e6ee5b6e8d99..f0b945ab853e 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -359,7 +359,7 @@ static inline void release_metapath(struct metapath *mp) | |||
359 | * Returns: The length of the extent (minimum of one block) | 359 | * Returns: The length of the extent (minimum of one block) |
360 | */ | 360 | */ |
361 | 361 | ||
362 | static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob) | 362 | static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, size_t limit, int *eob) |
363 | { | 363 | { |
364 | const __be64 *end = (start + len); | 364 | const __be64 *end = (start + len); |
365 | const __be64 *first = ptr; | 365 | const __be64 *first = ptr; |
@@ -449,7 +449,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
449 | struct buffer_head *bh_map, struct metapath *mp, | 449 | struct buffer_head *bh_map, struct metapath *mp, |
450 | const unsigned int sheight, | 450 | const unsigned int sheight, |
451 | const unsigned int height, | 451 | const unsigned int height, |
452 | const unsigned int maxlen) | 452 | const size_t maxlen) |
453 | { | 453 | { |
454 | struct gfs2_inode *ip = GFS2_I(inode); | 454 | struct gfs2_inode *ip = GFS2_I(inode); |
455 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 455 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
@@ -483,7 +483,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
483 | } else { | 483 | } else { |
484 | /* Need to allocate indirect blocks */ | 484 | /* Need to allocate indirect blocks */ |
485 | ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; | 485 | ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; |
486 | dblks = min(maxlen, ptrs_per_blk - mp->mp_list[end_of_metadata]); | 486 | dblks = min(maxlen, (size_t)(ptrs_per_blk - |
487 | mp->mp_list[end_of_metadata])); | ||
487 | if (height == ip->i_height) { | 488 | if (height == ip->i_height) { |
488 | /* Writing into existing tree, extend tree down */ | 489 | /* Writing into existing tree, extend tree down */ |
489 | iblks = height - sheight; | 490 | iblks = height - sheight; |
@@ -605,7 +606,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, | |||
605 | struct gfs2_inode *ip = GFS2_I(inode); | 606 | struct gfs2_inode *ip = GFS2_I(inode); |
606 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 607 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
607 | unsigned int bsize = sdp->sd_sb.sb_bsize; | 608 | unsigned int bsize = sdp->sd_sb.sb_bsize; |
608 | const unsigned int maxlen = bh_map->b_size >> inode->i_blkbits; | 609 | const size_t maxlen = bh_map->b_size >> inode->i_blkbits; |
609 | const u64 *arr = sdp->sd_heightsize; | 610 | const u64 *arr = sdp->sd_heightsize; |
610 | __be64 *ptr; | 611 | __be64 *ptr; |
611 | u64 size; | 612 | u64 size; |