aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2013-04-29 09:38:46 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-05-06 15:55:27 -0400
commit410748882ac703aa0550aa6c3c5656edd0462001 (patch)
tree8f5d6a53ad6d19af08f6991a6ee702269e28dbd0 /fs/btrfs/extent_io.c
parent625f1c8dc66d77878e1a563d6dd5722404968fbf (diff)
btrfs: use unsigned long type for extent state bits
Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 9b93e8076162..d2ac518f90e4 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -322,21 +322,21 @@ static void merge_state(struct extent_io_tree *tree,
322} 322}
323 323
324static void set_state_cb(struct extent_io_tree *tree, 324static void set_state_cb(struct extent_io_tree *tree,
325 struct extent_state *state, int *bits) 325 struct extent_state *state, unsigned long *bits)
326{ 326{
327 if (tree->ops && tree->ops->set_bit_hook) 327 if (tree->ops && tree->ops->set_bit_hook)
328 tree->ops->set_bit_hook(tree->mapping->host, state, bits); 328 tree->ops->set_bit_hook(tree->mapping->host, state, bits);
329} 329}
330 330
331static void clear_state_cb(struct extent_io_tree *tree, 331static void clear_state_cb(struct extent_io_tree *tree,
332 struct extent_state *state, int *bits) 332 struct extent_state *state, unsigned long *bits)
333{ 333{
334 if (tree->ops && tree->ops->clear_bit_hook) 334 if (tree->ops && tree->ops->clear_bit_hook)
335 tree->ops->clear_bit_hook(tree->mapping->host, state, bits); 335 tree->ops->clear_bit_hook(tree->mapping->host, state, bits);
336} 336}
337 337
338static void set_state_bits(struct extent_io_tree *tree, 338static void set_state_bits(struct extent_io_tree *tree,
339 struct extent_state *state, int *bits); 339 struct extent_state *state, unsigned long *bits);
340 340
341/* 341/*
342 * insert an extent_state struct into the tree. 'bits' are set on the 342 * insert an extent_state struct into the tree. 'bits' are set on the
@@ -350,7 +350,7 @@ static void set_state_bits(struct extent_io_tree *tree,
350 */ 350 */
351static int insert_state(struct extent_io_tree *tree, 351static int insert_state(struct extent_io_tree *tree,
352 struct extent_state *state, u64 start, u64 end, 352 struct extent_state *state, u64 start, u64 end,
353 int *bits) 353 unsigned long *bits)
354{ 354{
355 struct rb_node *node; 355 struct rb_node *node;
356 356
@@ -438,10 +438,10 @@ static struct extent_state *next_state(struct extent_state *state)
438 */ 438 */
439static struct extent_state *clear_state_bit(struct extent_io_tree *tree, 439static struct extent_state *clear_state_bit(struct extent_io_tree *tree,
440 struct extent_state *state, 440 struct extent_state *state,
441 int *bits, int wake) 441 unsigned long *bits, int wake)
442{ 442{
443 struct extent_state *next; 443 struct extent_state *next;
444 int bits_to_clear = *bits & ~EXTENT_CTLBITS; 444 unsigned long bits_to_clear = *bits & ~EXTENT_CTLBITS;
445 445
446 if ((bits_to_clear & EXTENT_DIRTY) && (state->state & EXTENT_DIRTY)) { 446 if ((bits_to_clear & EXTENT_DIRTY) && (state->state & EXTENT_DIRTY)) {
447 u64 range = state->end - state->start + 1; 447 u64 range = state->end - state->start + 1;
@@ -497,7 +497,7 @@ static void extent_io_tree_panic(struct extent_io_tree *tree, int err)
497 * This takes the tree lock, and returns 0 on success and < 0 on error. 497 * This takes the tree lock, and returns 0 on success and < 0 on error.
498 */ 498 */
499int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, 499int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
500 int bits, int wake, int delete, 500 unsigned long bits, int wake, int delete,
501 struct extent_state **cached_state, 501 struct extent_state **cached_state,
502 gfp_t mask) 502 gfp_t mask)
503{ 503{
@@ -658,8 +658,8 @@ static void wait_on_state(struct extent_io_tree *tree,
658 * The range [start, end] is inclusive. 658 * The range [start, end] is inclusive.
659 * The tree lock is taken by this function 659 * The tree lock is taken by this function
660 */ 660 */
661static void wait_extent_bit(struct extent_io_tree *tree, u64 start, 661static void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
662 u64 end, int bits) 662 unsigned long bits)
663{ 663{
664 struct extent_state *state; 664 struct extent_state *state;
665 struct rb_node *node; 665 struct rb_node *node;
@@ -700,9 +700,9 @@ out:
700 700
701static void set_state_bits(struct extent_io_tree *tree, 701static void set_state_bits(struct extent_io_tree *tree,
702 struct extent_state *state, 702 struct extent_state *state,
703 int *bits) 703 unsigned long *bits)
704{ 704{
705 int bits_to_set = *bits & ~EXTENT_CTLBITS; 705 unsigned long bits_to_set = *bits & ~EXTENT_CTLBITS;
706 706
707 set_state_cb(tree, state, bits); 707 set_state_cb(tree, state, bits);
708 if ((bits_to_set & EXTENT_DIRTY) && !(state->state & EXTENT_DIRTY)) { 708 if ((bits_to_set & EXTENT_DIRTY) && !(state->state & EXTENT_DIRTY)) {
@@ -745,8 +745,9 @@ static void uncache_state(struct extent_state **cached_ptr)
745 745
746static int __must_check 746static int __must_check
747__set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, 747__set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
748 int bits, int exclusive_bits, u64 *failed_start, 748 unsigned long bits, unsigned long exclusive_bits,
749 struct extent_state **cached_state, gfp_t mask) 749 u64 *failed_start, struct extent_state **cached_state,
750 gfp_t mask)
750{ 751{
751 struct extent_state *state; 752 struct extent_state *state;
752 struct extent_state *prealloc = NULL; 753 struct extent_state *prealloc = NULL;
@@ -938,9 +939,9 @@ search_again:
938 goto again; 939 goto again;
939} 940}
940 941
941int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits, 942int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
942 u64 *failed_start, struct extent_state **cached_state, 943 unsigned long bits, u64 * failed_start,
943 gfp_t mask) 944 struct extent_state **cached_state, gfp_t mask)
944{ 945{
945 return __set_extent_bit(tree, start, end, bits, 0, failed_start, 946 return __set_extent_bit(tree, start, end, bits, 0, failed_start,
946 cached_state, mask); 947 cached_state, mask);
@@ -965,7 +966,7 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits,
965 * boundary bits like LOCK. 966 * boundary bits like LOCK.
966 */ 967 */
967int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, 968int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
968 int bits, int clear_bits, 969 unsigned long bits, unsigned long clear_bits,
969 struct extent_state **cached_state, gfp_t mask) 970 struct extent_state **cached_state, gfp_t mask)
970{ 971{
971 struct extent_state *state; 972 struct extent_state *state;
@@ -1158,14 +1159,14 @@ int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
1158} 1159}
1159 1160
1160int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, 1161int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
1161 int bits, gfp_t mask) 1162 unsigned long bits, gfp_t mask)
1162{ 1163{
1163 return set_extent_bit(tree, start, end, bits, NULL, 1164 return set_extent_bit(tree, start, end, bits, NULL,
1164 NULL, mask); 1165 NULL, mask);
1165} 1166}
1166 1167
1167int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, 1168int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
1168 int bits, gfp_t mask) 1169 unsigned long bits, gfp_t mask)
1169{ 1170{
1170 return clear_extent_bit(tree, start, end, bits, 0, 0, NULL, mask); 1171 return clear_extent_bit(tree, start, end, bits, 0, 0, NULL, mask);
1171} 1172}
@@ -1220,7 +1221,7 @@ int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
1220 * us if waiting is desired. 1221 * us if waiting is desired.
1221 */ 1222 */
1222int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, 1223int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
1223 int bits, struct extent_state **cached_state) 1224 unsigned long bits, struct extent_state **cached_state)
1224{ 1225{
1225 int err; 1226 int err;
1226 u64 failed_start; 1227 u64 failed_start;
@@ -1330,7 +1331,7 @@ static int set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end)
1330 */ 1331 */
1331static struct extent_state * 1332static struct extent_state *
1332find_first_extent_bit_state(struct extent_io_tree *tree, 1333find_first_extent_bit_state(struct extent_io_tree *tree,
1333 u64 start, int bits) 1334 u64 start, unsigned long bits)
1334{ 1335{
1335 struct rb_node *node; 1336 struct rb_node *node;
1336 struct extent_state *state; 1337 struct extent_state *state;
@@ -1364,7 +1365,7 @@ out:
1364 * If nothing was found, 1 is returned. If found something, return 0. 1365 * If nothing was found, 1 is returned. If found something, return 0.
1365 */ 1366 */
1366int find_first_extent_bit(struct extent_io_tree *tree, u64 start, 1367int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
1367 u64 *start_ret, u64 *end_ret, int bits, 1368 u64 *start_ret, u64 *end_ret, unsigned long bits,
1368 struct extent_state **cached_state) 1369 struct extent_state **cached_state)
1369{ 1370{
1370 struct extent_state *state; 1371 struct extent_state *state;
@@ -1654,7 +1655,7 @@ int extent_clear_unlock_delalloc(struct inode *inode,
1654 unsigned long end_index = end >> PAGE_CACHE_SHIFT; 1655 unsigned long end_index = end >> PAGE_CACHE_SHIFT;
1655 unsigned long nr_pages = end_index - index + 1; 1656 unsigned long nr_pages = end_index - index + 1;
1656 int i; 1657 int i;
1657 int clear_bits = 0; 1658 unsigned long clear_bits = 0;
1658 1659
1659 if (op & EXTENT_CLEAR_UNLOCK) 1660 if (op & EXTENT_CLEAR_UNLOCK)
1660 clear_bits |= EXTENT_LOCKED; 1661 clear_bits |= EXTENT_LOCKED;
@@ -1885,7 +1886,7 @@ out:
1885 * range is found set. 1886 * range is found set.
1886 */ 1887 */
1887int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, 1888int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
1888 int bits, int filled, struct extent_state *cached) 1889 unsigned long bits, int filled, struct extent_state *cached)
1889{ 1890{
1890 struct extent_state *state = NULL; 1891 struct extent_state *state = NULL;
1891 struct rb_node *node; 1892 struct rb_node *node;