* [Cluster-devel] [GFS2 PATCH] GFS2: Change maxlen variables to size_t [not found] <1526676745.2537367.1407330433566.JavaMail.zimbra@redhat.com> @ 2014-08-06 13:08 ` Bob Peterson 2014-08-06 16:48 ` Steven Whitehouse 0 siblings, 1 reply; 2+ messages in thread From: Bob Peterson @ 2014-08-06 13:08 UTC (permalink / raw) To: cluster-devel.redhat.com Hi, 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. Regards, Bob Peterson Red Hat File Systems Signed-off-by: Bob Peterson <rpeterso@redhat.com> --- diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index e6ee5b6..f0b945a 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -359,7 +359,7 @@ static inline void release_metapath(struct metapath *mp) * Returns: The length of the extent (minimum of one block) */ -static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob) +static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, size_t limit, int *eob) { const __be64 *end = (start + len); const __be64 *first = ptr; @@ -449,7 +449,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, struct buffer_head *bh_map, struct metapath *mp, const unsigned int sheight, const unsigned int height, - const unsigned int maxlen) + const size_t maxlen) { struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); @@ -483,7 +483,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, } else { /* Need to allocate indirect blocks */ ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; - dblks = min(maxlen, ptrs_per_blk - mp->mp_list[end_of_metadata]); + dblks = min(maxlen, (size_t)(ptrs_per_blk - + mp->mp_list[end_of_metadata])); if (height == ip->i_height) { /* Writing into existing tree, extend tree down */ iblks = height - sheight; @@ -605,7 +606,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); unsigned int bsize = sdp->sd_sb.sb_bsize; - const unsigned int maxlen = bh_map->b_size >> inode->i_blkbits; + const size_t maxlen = bh_map->b_size >> inode->i_blkbits; const u64 *arr = sdp->sd_heightsize; __be64 *ptr; u64 size; ^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [GFS2 PATCH] GFS2: Change maxlen variables to size_t 2014-08-06 13:08 ` [Cluster-devel] [GFS2 PATCH] GFS2: Change maxlen variables to size_t Bob Peterson @ 2014-08-06 16:48 ` Steven Whitehouse 0 siblings, 0 replies; 2+ messages in thread From: Steven Whitehouse @ 2014-08-06 16:48 UTC (permalink / raw) To: cluster-devel.redhat.com Hi, On 06/08/14 14:08, Bob Peterson wrote: > Hi, > > 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. Now in the -nmw tree. Thanks, Steve. > Regards, > > Bob Peterson > Red Hat File Systems > > Signed-off-by: Bob Peterson <rpeterso@redhat.com> > --- > diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c > index e6ee5b6..f0b945a 100644 > --- a/fs/gfs2/bmap.c > +++ b/fs/gfs2/bmap.c > @@ -359,7 +359,7 @@ static inline void release_metapath(struct metapath *mp) > * Returns: The length of the extent (minimum of one block) > */ > > -static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob) > +static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, size_t limit, int *eob) > { > const __be64 *end = (start + len); > const __be64 *first = ptr; > @@ -449,7 +449,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, > struct buffer_head *bh_map, struct metapath *mp, > const unsigned int sheight, > const unsigned int height, > - const unsigned int maxlen) > + const size_t maxlen) > { > struct gfs2_inode *ip = GFS2_I(inode); > struct gfs2_sbd *sdp = GFS2_SB(inode); > @@ -483,7 +483,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, > } else { > /* Need to allocate indirect blocks */ > ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; > - dblks = min(maxlen, ptrs_per_blk - mp->mp_list[end_of_metadata]); > + dblks = min(maxlen, (size_t)(ptrs_per_blk - > + mp->mp_list[end_of_metadata])); > if (height == ip->i_height) { > /* Writing into existing tree, extend tree down */ > iblks = height - sheight; > @@ -605,7 +606,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, > struct gfs2_inode *ip = GFS2_I(inode); > struct gfs2_sbd *sdp = GFS2_SB(inode); > unsigned int bsize = sdp->sd_sb.sb_bsize; > - const unsigned int maxlen = bh_map->b_size >> inode->i_blkbits; > + const size_t maxlen = bh_map->b_size >> inode->i_blkbits; > const u64 *arr = sdp->sd_heightsize; > __be64 *ptr; > u64 size; > ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-06 16:48 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1526676745.2537367.1407330433566.JavaMail.zimbra@redhat.com> 2014-08-06 13:08 ` [Cluster-devel] [GFS2 PATCH] GFS2: Change maxlen variables to size_t Bob Peterson 2014-08-06 16:48 ` Steven Whitehouse
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).