diff options
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 7f8e3035d99e..0325dc038592 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -82,7 +82,7 @@ static int dirty_and_release_pages(struct btrfs_trans_handle *trans, | |||
82 | 82 | ||
83 | for (i = 0; i < num_pages; i++) { | 83 | for (i = 0; i < num_pages; i++) { |
84 | offset = pos & (PAGE_CACHE_SIZE -1); | 84 | offset = pos & (PAGE_CACHE_SIZE -1); |
85 | this_write = min(PAGE_CACHE_SIZE - offset, write_bytes); | 85 | this_write = min((size_t)PAGE_CACHE_SIZE - offset, write_bytes); |
86 | /* FIXME, one block at a time */ | 86 | /* FIXME, one block at a time */ |
87 | 87 | ||
88 | mutex_lock(&root->fs_info->fs_mutex); | 88 | mutex_lock(&root->fs_info->fs_mutex); |
@@ -395,7 +395,7 @@ static int prepare_pages(struct btrfs_root *root, | |||
395 | cancel_dirty_page(pages[i], PAGE_CACHE_SIZE); | 395 | cancel_dirty_page(pages[i], PAGE_CACHE_SIZE); |
396 | wait_on_page_writeback(pages[i]); | 396 | wait_on_page_writeback(pages[i]); |
397 | offset = pos & (PAGE_CACHE_SIZE -1); | 397 | offset = pos & (PAGE_CACHE_SIZE -1); |
398 | this_write = min(PAGE_CACHE_SIZE - offset, write_bytes); | 398 | this_write = min((size_t)PAGE_CACHE_SIZE - offset, write_bytes); |
399 | if (!page_has_buffers(pages[i])) { | 399 | if (!page_has_buffers(pages[i])) { |
400 | create_empty_buffers(pages[i], | 400 | create_empty_buffers(pages[i], |
401 | root->fs_info->sb->s_blocksize, | 401 | root->fs_info->sb->s_blocksize, |
@@ -567,7 +567,8 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf, | |||
567 | 567 | ||
568 | while(count > 0) { | 568 | while(count > 0) { |
569 | size_t offset = pos & (PAGE_CACHE_SIZE - 1); | 569 | size_t offset = pos & (PAGE_CACHE_SIZE - 1); |
570 | size_t write_bytes = min(count, PAGE_CACHE_SIZE - offset); | 570 | size_t write_bytes = min(count, |
571 | (size_t)PAGE_CACHE_SIZE - offset); | ||
571 | size_t num_pages = (write_bytes + PAGE_CACHE_SIZE - 1) >> | 572 | size_t num_pages = (write_bytes + PAGE_CACHE_SIZE - 1) >> |
572 | PAGE_CACHE_SHIFT; | 573 | PAGE_CACHE_SHIFT; |
573 | 574 | ||