aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-07-20 14:58:36 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2007-08-09 20:25:27 -0400
commit7c08d70c69150148c14f02633855f1591219c37c (patch)
treed33828db9b500afbd2168e9667dddb8450683804 /fs
parenta00cce356b5592208e761525a48a25902322cce9 (diff)
ocfs2: Fix some casting errors related to file writes
ocfs2_align_clusters_to_page_index() needs to cast the clusters shift to pgoff_t and ocfs2_file_buffered_write() needs loff_t when calculating destination start for memcpy. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/file.c2
-rw-r--r--fs/ocfs2/ocfs2.h8
2 files changed, 5 insertions, 5 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 7e508e2942ca..b1ae4c754157 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1959,7 +1959,7 @@ static ssize_t ocfs2_file_buffered_write(struct file *file, loff_t *ppos,
1959 } 1959 }
1960 1960
1961 dst = kmap_atomic(page, KM_USER0); 1961 dst = kmap_atomic(page, KM_USER0);
1962 memcpy(dst + (pos & (PAGE_CACHE_SIZE - 1)), buf, bytes); 1962 memcpy(dst + (pos & (loff_t)(PAGE_CACHE_SIZE - 1)), buf, bytes);
1963 kunmap_atomic(dst, KM_USER0); 1963 kunmap_atomic(dst, KM_USER0);
1964 flush_dcache_page(page); 1964 flush_dcache_page(page);
1965 ocfs2_put_write_source(user_page); 1965 ocfs2_put_write_source(user_page);
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 5cc90a40b3c5..58307853fb4a 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -494,16 +494,16 @@ static inline unsigned int ocfs2_page_index_to_clusters(struct super_block *sb,
494/* 494/*
495 * Find the 1st page index which covers the given clusters. 495 * Find the 1st page index which covers the given clusters.
496 */ 496 */
497static inline unsigned long ocfs2_align_clusters_to_page_index(struct super_block *sb, 497static inline pgoff_t ocfs2_align_clusters_to_page_index(struct super_block *sb,
498 u32 clusters) 498 u32 clusters)
499{ 499{
500 unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits; 500 unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits;
501 unsigned long index = clusters; 501 pgoff_t index = clusters;
502 502
503 if (PAGE_CACHE_SHIFT > cbits) { 503 if (PAGE_CACHE_SHIFT > cbits) {
504 index = clusters >> (PAGE_CACHE_SHIFT - cbits); 504 index = (pgoff_t)clusters >> (PAGE_CACHE_SHIFT - cbits);
505 } else if (PAGE_CACHE_SHIFT < cbits) { 505 } else if (PAGE_CACHE_SHIFT < cbits) {
506 index = clusters << (cbits - PAGE_CACHE_SHIFT); 506 index = (pgoff_t)clusters << (cbits - PAGE_CACHE_SHIFT);
507 } 507 }
508 508
509 return index; 509 return index;