From 3c33295728e0b241a3976c5eb87707135df1c195 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Thu, 16 Aug 2007 13:38:52 -0700 Subject: ocfs2: Fix casting error in page index calculation ocfs2_align_clusters_to_page_index() needs to cast the clusters shift to pgoff_t, otherwise we lose information. Signed-off-by: Mark Fasheh --- fs/ocfs2/ocfs2.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index a860633..0367108 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h @@ -480,16 +480,16 @@ static inline unsigned int ocfs2_page_index_to_clusters(struct super_block *sb, /* * Find the 1st page index which covers the given clusters. */ -static inline unsigned long ocfs2_align_clusters_to_page_index(struct super_block *sb, +static inline pgoff_t ocfs2_align_clusters_to_page_index(struct super_block *sb, u32 clusters) { unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits; - unsigned long index = clusters; + pgoff_t index = clusters; if (PAGE_CACHE_SHIFT > cbits) { - index = clusters >> (PAGE_CACHE_SHIFT - cbits); + index = (pgoff_t)clusters >> (PAGE_CACHE_SHIFT - cbits); } else if (PAGE_CACHE_SHIFT < cbits) { - index = clusters << (cbits - PAGE_CACHE_SHIFT); + index = (pgoff_t)clusters << (cbits - PAGE_CACHE_SHIFT); } return index; -- 1.5.3.4