aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/compression.c3
-rw-r--r--fs/btrfs/extent_io.c11
-rw-r--r--fs/btrfs/inode.c4
-rw-r--r--fs/btrfs/zlib.c2
4 files changed, 12 insertions, 8 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index b582c6fd80f2..bfd1512cce0a 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -174,7 +174,8 @@ static noinline int end_compressed_writeback(struct inode *inode, u64 start,
174 174
175 while(nr_pages > 0) { 175 while(nr_pages > 0) {
176 ret = find_get_pages_contig(inode->i_mapping, index, 176 ret = find_get_pages_contig(inode->i_mapping, index,
177 min(nr_pages, ARRAY_SIZE(pages)), pages); 177 min_t(unsigned long,
178 nr_pages, ARRAY_SIZE(pages)), pages);
178 if (ret == 0) { 179 if (ret == 0) {
179 nr_pages -= 1; 180 nr_pages -= 1;
180 index += 1; 181 index += 1;
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 5cc0082379ce..54d013c3bb88 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1157,7 +1157,8 @@ static noinline int __unlock_for_delalloc(struct inode *inode,
1157 1157
1158 while(nr_pages > 0) { 1158 while(nr_pages > 0) {
1159 ret = find_get_pages_contig(inode->i_mapping, index, 1159 ret = find_get_pages_contig(inode->i_mapping, index,
1160 min(nr_pages, ARRAY_SIZE(pages)), pages); 1160 min_t(unsigned long, nr_pages,
1161 ARRAY_SIZE(pages)), pages);
1161 for (i = 0; i < ret; i++) { 1162 for (i = 0; i < ret; i++) {
1162 if (pages[i] != locked_page) 1163 if (pages[i] != locked_page)
1163 unlock_page(pages[i]); 1164 unlock_page(pages[i]);
@@ -1192,7 +1193,8 @@ static noinline int lock_delalloc_pages(struct inode *inode,
1192 nrpages = end_index - index + 1; 1193 nrpages = end_index - index + 1;
1193 while(nrpages > 0) { 1194 while(nrpages > 0) {
1194 ret = find_get_pages_contig(inode->i_mapping, index, 1195 ret = find_get_pages_contig(inode->i_mapping, index,
1195 min(nrpages, ARRAY_SIZE(pages)), pages); 1196 min_t(unsigned long,
1197 nrpages, ARRAY_SIZE(pages)), pages);
1196 if (ret == 0) { 1198 if (ret == 0) {
1197 ret = -EAGAIN; 1199 ret = -EAGAIN;
1198 goto done; 1200 goto done;
@@ -1346,7 +1348,8 @@ int extent_clear_unlock_delalloc(struct inode *inode,
1346 1348
1347 while(nr_pages > 0) { 1349 while(nr_pages > 0) {
1348 ret = find_get_pages_contig(inode->i_mapping, index, 1350 ret = find_get_pages_contig(inode->i_mapping, index,
1349 min(nr_pages, ARRAY_SIZE(pages)), pages); 1351 min_t(unsigned long,
1352 nr_pages, ARRAY_SIZE(pages)), pages);
1350 for (i = 0; i < ret; i++) { 1353 for (i = 0; i < ret; i++) {
1351 if (pages[i] == locked_page) { 1354 if (pages[i] == locked_page) {
1352 page_cache_release(pages[i]); 1355 page_cache_release(pages[i]);
@@ -1896,7 +1899,7 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree,
1896 int contig = 0; 1899 int contig = 0;
1897 int this_compressed = bio_flags & EXTENT_BIO_COMPRESSED; 1900 int this_compressed = bio_flags & EXTENT_BIO_COMPRESSED;
1898 int old_compressed = prev_bio_flags & EXTENT_BIO_COMPRESSED; 1901 int old_compressed = prev_bio_flags & EXTENT_BIO_COMPRESSED;
1899 size_t page_size = min(size, PAGE_CACHE_SIZE); 1902 size_t page_size = min_t(size_t, size, PAGE_CACHE_SIZE);
1900 1903
1901 if (bio_ret && *bio_ret) { 1904 if (bio_ret && *bio_ret) {
1902 bio = *bio_ret; 1905 bio = *bio_ret;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5ca9c0672374..2ed2deacde90 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -184,7 +184,7 @@ static int noinline insert_inline_extent(struct btrfs_trans_handle *trans,
184 int i = 0; 184 int i = 0;
185 while(compressed_size > 0) { 185 while(compressed_size > 0) {
186 cpage = compressed_pages[i]; 186 cpage = compressed_pages[i];
187 cur_size = min(compressed_size, 187 cur_size = min_t(unsigned long, compressed_size,
188 PAGE_CACHE_SIZE); 188 PAGE_CACHE_SIZE);
189 189
190 kaddr = kmap(cpage); 190 kaddr = kmap(cpage);
@@ -3812,7 +3812,7 @@ static noinline int uncompress_inline(struct btrfs_path *path,
3812 3812
3813 read_extent_buffer(leaf, tmp, ptr, inline_size); 3813 read_extent_buffer(leaf, tmp, ptr, inline_size);
3814 3814
3815 max_size = min(PAGE_CACHE_SIZE, max_size); 3815 max_size = min_t(unsigned long, PAGE_CACHE_SIZE, max_size);
3816 ret = btrfs_zlib_decompress(tmp, page, extent_offset, 3816 ret = btrfs_zlib_decompress(tmp, page, extent_offset,
3817 inline_size, max_size); 3817 inline_size, max_size);
3818 if (ret) { 3818 if (ret) {
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index ba2527d08734..5b9f7002513c 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -370,7 +370,7 @@ int btrfs_zlib_decompress_biovec(struct page **pages_in,
370 370
371 data_in = kmap(pages_in[page_in_index]); 371 data_in = kmap(pages_in[page_in_index]);
372 workspace->inf_strm.next_in = data_in; 372 workspace->inf_strm.next_in = data_in;
373 workspace->inf_strm.avail_in = min(srclen, PAGE_CACHE_SIZE); 373 workspace->inf_strm.avail_in = min_t(size_t, srclen, PAGE_CACHE_SIZE);
374 workspace->inf_strm.total_in = 0; 374 workspace->inf_strm.total_in = 0;
375 375
376 workspace->inf_strm.total_out = 0; 376 workspace->inf_strm.total_out = 0;