aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
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
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')
-rw-r--r--fs/btrfs/extent_io.c49
-rw-r--r--fs/btrfs/extent_io.h23
-rw-r--r--fs/btrfs/inode.c5
3 files changed, 40 insertions, 37 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;
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 3af58bf55ddc..a2c03a175009 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -81,9 +81,9 @@ struct extent_io_ops {
81 int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end, 81 int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
82 struct extent_state *state, int uptodate); 82 struct extent_state *state, int uptodate);
83 void (*set_bit_hook)(struct inode *inode, struct extent_state *state, 83 void (*set_bit_hook)(struct inode *inode, struct extent_state *state,
84 int *bits); 84 unsigned long *bits);
85 void (*clear_bit_hook)(struct inode *inode, struct extent_state *state, 85 void (*clear_bit_hook)(struct inode *inode, struct extent_state *state,
86 int *bits); 86 unsigned long *bits);
87 void (*merge_extent_hook)(struct inode *inode, 87 void (*merge_extent_hook)(struct inode *inode,
88 struct extent_state *new, 88 struct extent_state *new,
89 struct extent_state *other); 89 struct extent_state *other);
@@ -192,7 +192,7 @@ int try_release_extent_mapping(struct extent_map_tree *map,
192int try_release_extent_buffer(struct page *page); 192int try_release_extent_buffer(struct page *page);
193int lock_extent(struct extent_io_tree *tree, u64 start, u64 end); 193int lock_extent(struct extent_io_tree *tree, u64 start, u64 end);
194int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, 194int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
195 int bits, struct extent_state **cached); 195 unsigned long bits, struct extent_state **cached);
196int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end); 196int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end);
197int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end, 197int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end,
198 struct extent_state **cached, gfp_t mask); 198 struct extent_state **cached, gfp_t mask);
@@ -208,16 +208,17 @@ u64 count_range_bits(struct extent_io_tree *tree,
208 208
209void free_extent_state(struct extent_state *state); 209void free_extent_state(struct extent_state *state);
210int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, 210int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
211 int bits, int filled, struct extent_state *cached_state); 211 unsigned long bits, int filled,
212 struct extent_state *cached_state);
212int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, 213int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
213 int bits, gfp_t mask); 214 unsigned long bits, gfp_t mask);
214int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, 215int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
215 int bits, int wake, int delete, struct extent_state **cached, 216 unsigned long bits, int wake, int delete,
216 gfp_t mask); 217 struct extent_state **cached, gfp_t mask);
217int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, 218int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
218 int bits, gfp_t mask); 219 unsigned long bits, gfp_t mask);
219int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, 220int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
220 int bits, u64 *failed_start, 221 unsigned long bits, u64 *failed_start,
221 struct extent_state **cached_state, gfp_t mask); 222 struct extent_state **cached_state, gfp_t mask);
222int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, 223int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
223 struct extent_state **cached_state, gfp_t mask); 224 struct extent_state **cached_state, gfp_t mask);
@@ -230,14 +231,14 @@ int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
230int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end, 231int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
231 gfp_t mask); 232 gfp_t mask);
232int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, 233int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
233 int bits, int clear_bits, 234 unsigned long bits, unsigned long clear_bits,
234 struct extent_state **cached_state, gfp_t mask); 235 struct extent_state **cached_state, gfp_t mask);
235int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end, 236int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
236 struct extent_state **cached_state, gfp_t mask); 237 struct extent_state **cached_state, gfp_t mask);
237int set_extent_defrag(struct extent_io_tree *tree, u64 start, u64 end, 238int set_extent_defrag(struct extent_io_tree *tree, u64 start, u64 end,
238 struct extent_state **cached_state, gfp_t mask); 239 struct extent_state **cached_state, gfp_t mask);
239int find_first_extent_bit(struct extent_io_tree *tree, u64 start, 240int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
240 u64 *start_ret, u64 *end_ret, int bits, 241 u64 *start_ret, u64 *end_ret, unsigned long bits,
241 struct extent_state **cached_state); 242 struct extent_state **cached_state);
242int extent_invalidatepage(struct extent_io_tree *tree, 243int extent_invalidatepage(struct extent_io_tree *tree,
243 struct page *page, unsigned long offset); 244 struct page *page, unsigned long offset);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ec63d7af3460..1669c3b4be2f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1530,7 +1530,7 @@ static void btrfs_merge_extent_hook(struct inode *inode,
1530 * have pending delalloc work to be done. 1530 * have pending delalloc work to be done.
1531 */ 1531 */
1532static void btrfs_set_bit_hook(struct inode *inode, 1532static void btrfs_set_bit_hook(struct inode *inode,
1533 struct extent_state *state, int *bits) 1533 struct extent_state *state, unsigned long *bits)
1534{ 1534{
1535 1535
1536 /* 1536 /*
@@ -1574,7 +1574,8 @@ static void btrfs_set_bit_hook(struct inode *inode,
1574 * extent_io.c clear_bit_hook, see set_bit_hook for why 1574 * extent_io.c clear_bit_hook, see set_bit_hook for why
1575 */ 1575 */
1576static void btrfs_clear_bit_hook(struct inode *inode, 1576static void btrfs_clear_bit_hook(struct inode *inode,
1577 struct extent_state *state, int *bits) 1577 struct extent_state *state,
1578 unsigned long *bits)
1578{ 1579{
1579 /* 1580 /*
1580 * set_bit and clear bit hooks normally require _irqsave/restore 1581 * set_bit and clear bit hooks normally require _irqsave/restore