Commit 41074888 authored by David Sterba's avatar David Sterba Committed by Josef Bacik

btrfs: use unsigned long type for extent state bits

Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 625f1c8d
...@@ -322,21 +322,21 @@ static void merge_state(struct extent_io_tree *tree, ...@@ -322,21 +322,21 @@ static void merge_state(struct extent_io_tree *tree,
} }
static void set_state_cb(struct extent_io_tree *tree, static void set_state_cb(struct extent_io_tree *tree,
struct extent_state *state, int *bits) struct extent_state *state, unsigned long *bits)
{ {
if (tree->ops && tree->ops->set_bit_hook) if (tree->ops && tree->ops->set_bit_hook)
tree->ops->set_bit_hook(tree->mapping->host, state, bits); tree->ops->set_bit_hook(tree->mapping->host, state, bits);
} }
static void clear_state_cb(struct extent_io_tree *tree, static void clear_state_cb(struct extent_io_tree *tree,
struct extent_state *state, int *bits) struct extent_state *state, unsigned long *bits)
{ {
if (tree->ops && tree->ops->clear_bit_hook) if (tree->ops && tree->ops->clear_bit_hook)
tree->ops->clear_bit_hook(tree->mapping->host, state, bits); tree->ops->clear_bit_hook(tree->mapping->host, state, bits);
} }
static void set_state_bits(struct extent_io_tree *tree, static void set_state_bits(struct extent_io_tree *tree,
struct extent_state *state, int *bits); struct extent_state *state, unsigned long *bits);
/* /*
* insert an extent_state struct into the tree. 'bits' are set on the * 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,7 +350,7 @@ static void set_state_bits(struct extent_io_tree *tree,
*/ */
static int insert_state(struct extent_io_tree *tree, static int insert_state(struct extent_io_tree *tree,
struct extent_state *state, u64 start, u64 end, struct extent_state *state, u64 start, u64 end,
int *bits) unsigned long *bits)
{ {
struct rb_node *node; struct rb_node *node;
...@@ -438,10 +438,10 @@ static struct extent_state *next_state(struct extent_state *state) ...@@ -438,10 +438,10 @@ static struct extent_state *next_state(struct extent_state *state)
*/ */
static struct extent_state *clear_state_bit(struct extent_io_tree *tree, static struct extent_state *clear_state_bit(struct extent_io_tree *tree,
struct extent_state *state, struct extent_state *state,
int *bits, int wake) unsigned long *bits, int wake)
{ {
struct extent_state *next; struct extent_state *next;
int bits_to_clear = *bits & ~EXTENT_CTLBITS; unsigned long bits_to_clear = *bits & ~EXTENT_CTLBITS;
if ((bits_to_clear & EXTENT_DIRTY) && (state->state & EXTENT_DIRTY)) { if ((bits_to_clear & EXTENT_DIRTY) && (state->state & EXTENT_DIRTY)) {
u64 range = state->end - state->start + 1; 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,7 +497,7 @@ static void extent_io_tree_panic(struct extent_io_tree *tree, int err)
* This takes the tree lock, and returns 0 on success and < 0 on error. * This takes the tree lock, and returns 0 on success and < 0 on error.
*/ */
int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int wake, int delete, unsigned long bits, int wake, int delete,
struct extent_state **cached_state, struct extent_state **cached_state,
gfp_t mask) gfp_t mask)
{ {
...@@ -658,8 +658,8 @@ static void wait_on_state(struct extent_io_tree *tree, ...@@ -658,8 +658,8 @@ static void wait_on_state(struct extent_io_tree *tree,
* The range [start, end] is inclusive. * The range [start, end] is inclusive.
* The tree lock is taken by this function * The tree lock is taken by this function
*/ */
static void wait_extent_bit(struct extent_io_tree *tree, u64 start, static void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
u64 end, int bits) unsigned long bits)
{ {
struct extent_state *state; struct extent_state *state;
struct rb_node *node; struct rb_node *node;
...@@ -700,9 +700,9 @@ static void wait_extent_bit(struct extent_io_tree *tree, u64 start, ...@@ -700,9 +700,9 @@ static void wait_extent_bit(struct extent_io_tree *tree, u64 start,
static void set_state_bits(struct extent_io_tree *tree, static void set_state_bits(struct extent_io_tree *tree,
struct extent_state *state, struct extent_state *state,
int *bits) unsigned long *bits)
{ {
int bits_to_set = *bits & ~EXTENT_CTLBITS; unsigned long bits_to_set = *bits & ~EXTENT_CTLBITS;
set_state_cb(tree, state, bits); set_state_cb(tree, state, bits);
if ((bits_to_set & EXTENT_DIRTY) && !(state->state & EXTENT_DIRTY)) { if ((bits_to_set & EXTENT_DIRTY) && !(state->state & EXTENT_DIRTY)) {
...@@ -745,8 +745,9 @@ static void uncache_state(struct extent_state **cached_ptr) ...@@ -745,8 +745,9 @@ static void uncache_state(struct extent_state **cached_ptr)
static int __must_check static int __must_check
__set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int exclusive_bits, u64 *failed_start, unsigned long bits, unsigned long exclusive_bits,
struct extent_state **cached_state, gfp_t mask) u64 *failed_start, struct extent_state **cached_state,
gfp_t mask)
{ {
struct extent_state *state; struct extent_state *state;
struct extent_state *prealloc = NULL; struct extent_state *prealloc = NULL;
...@@ -938,9 +939,9 @@ __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -938,9 +939,9 @@ __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
goto again; goto again;
} }
int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits, int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
u64 *failed_start, struct extent_state **cached_state, unsigned long bits, u64 * failed_start,
gfp_t mask) struct extent_state **cached_state, gfp_t mask)
{ {
return __set_extent_bit(tree, start, end, bits, 0, failed_start, return __set_extent_bit(tree, start, end, bits, 0, failed_start,
cached_state, mask); cached_state, mask);
...@@ -965,7 +966,7 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits, ...@@ -965,7 +966,7 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits,
* boundary bits like LOCK. * boundary bits like LOCK.
*/ */
int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int clear_bits, unsigned long bits, unsigned long clear_bits,
struct extent_state **cached_state, gfp_t mask) struct extent_state **cached_state, gfp_t mask)
{ {
struct extent_state *state; struct extent_state *state;
...@@ -1158,14 +1159,14 @@ int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -1158,14 +1159,14 @@ int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
} }
int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, gfp_t mask) unsigned long bits, gfp_t mask)
{ {
return set_extent_bit(tree, start, end, bits, NULL, return set_extent_bit(tree, start, end, bits, NULL,
NULL, mask); NULL, mask);
} }
int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, gfp_t mask) unsigned long bits, gfp_t mask)
{ {
return clear_extent_bit(tree, start, end, bits, 0, 0, NULL, mask); return clear_extent_bit(tree, start, end, bits, 0, 0, NULL, mask);
} }
...@@ -1220,7 +1221,7 @@ int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -1220,7 +1221,7 @@ int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
* us if waiting is desired. * us if waiting is desired.
*/ */
int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, struct extent_state **cached_state) unsigned long bits, struct extent_state **cached_state)
{ {
int err; int err;
u64 failed_start; u64 failed_start;
...@@ -1330,7 +1331,7 @@ static int set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end) ...@@ -1330,7 +1331,7 @@ static int set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end)
*/ */
static struct extent_state * static struct extent_state *
find_first_extent_bit_state(struct extent_io_tree *tree, find_first_extent_bit_state(struct extent_io_tree *tree,
u64 start, int bits) u64 start, unsigned long bits)
{ {
struct rb_node *node; struct rb_node *node;
struct extent_state *state; struct extent_state *state;
...@@ -1364,7 +1365,7 @@ find_first_extent_bit_state(struct extent_io_tree *tree, ...@@ -1364,7 +1365,7 @@ find_first_extent_bit_state(struct extent_io_tree *tree,
* If nothing was found, 1 is returned. If found something, return 0. * If nothing was found, 1 is returned. If found something, return 0.
*/ */
int find_first_extent_bit(struct extent_io_tree *tree, u64 start, int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
u64 *start_ret, u64 *end_ret, int bits, u64 *start_ret, u64 *end_ret, unsigned long bits,
struct extent_state **cached_state) struct extent_state **cached_state)
{ {
struct extent_state *state; struct extent_state *state;
...@@ -1654,7 +1655,7 @@ int extent_clear_unlock_delalloc(struct inode *inode, ...@@ -1654,7 +1655,7 @@ int extent_clear_unlock_delalloc(struct inode *inode,
unsigned long end_index = end >> PAGE_CACHE_SHIFT; unsigned long end_index = end >> PAGE_CACHE_SHIFT;
unsigned long nr_pages = end_index - index + 1; unsigned long nr_pages = end_index - index + 1;
int i; int i;
int clear_bits = 0; unsigned long clear_bits = 0;
if (op & EXTENT_CLEAR_UNLOCK) if (op & EXTENT_CLEAR_UNLOCK)
clear_bits |= EXTENT_LOCKED; clear_bits |= EXTENT_LOCKED;
...@@ -1885,7 +1886,7 @@ int get_state_private(struct extent_io_tree *tree, u64 start, u64 *private) ...@@ -1885,7 +1886,7 @@ int get_state_private(struct extent_io_tree *tree, u64 start, u64 *private)
* range is found set. * range is found set.
*/ */
int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int filled, struct extent_state *cached) unsigned long bits, int filled, struct extent_state *cached)
{ {
struct extent_state *state = NULL; struct extent_state *state = NULL;
struct rb_node *node; struct rb_node *node;
......
...@@ -81,9 +81,9 @@ struct extent_io_ops { ...@@ -81,9 +81,9 @@ struct extent_io_ops {
int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end, int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
struct extent_state *state, int uptodate); struct extent_state *state, int uptodate);
void (*set_bit_hook)(struct inode *inode, struct extent_state *state, void (*set_bit_hook)(struct inode *inode, struct extent_state *state,
int *bits); unsigned long *bits);
void (*clear_bit_hook)(struct inode *inode, struct extent_state *state, void (*clear_bit_hook)(struct inode *inode, struct extent_state *state,
int *bits); unsigned long *bits);
void (*merge_extent_hook)(struct inode *inode, void (*merge_extent_hook)(struct inode *inode,
struct extent_state *new, struct extent_state *new,
struct extent_state *other); struct extent_state *other);
...@@ -192,7 +192,7 @@ int try_release_extent_mapping(struct extent_map_tree *map, ...@@ -192,7 +192,7 @@ int try_release_extent_mapping(struct extent_map_tree *map,
int try_release_extent_buffer(struct page *page); int try_release_extent_buffer(struct page *page);
int lock_extent(struct extent_io_tree *tree, u64 start, u64 end); int lock_extent(struct extent_io_tree *tree, u64 start, u64 end);
int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, struct extent_state **cached); unsigned long bits, struct extent_state **cached);
int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end); int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end);
int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end, int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached, gfp_t mask); struct extent_state **cached, gfp_t mask);
...@@ -208,16 +208,17 @@ u64 count_range_bits(struct extent_io_tree *tree, ...@@ -208,16 +208,17 @@ u64 count_range_bits(struct extent_io_tree *tree,
void free_extent_state(struct extent_state *state); void free_extent_state(struct extent_state *state);
int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int filled, struct extent_state *cached_state); unsigned long bits, int filled,
struct extent_state *cached_state);
int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, gfp_t mask); unsigned long bits, gfp_t mask);
int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int wake, int delete, struct extent_state **cached, unsigned long bits, int wake, int delete,
gfp_t mask); struct extent_state **cached, gfp_t mask);
int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, gfp_t mask); unsigned long bits, gfp_t mask);
int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, u64 *failed_start, unsigned long bits, u64 *failed_start,
struct extent_state **cached_state, gfp_t mask); struct extent_state **cached_state, gfp_t mask);
int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached_state, gfp_t mask); 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, ...@@ -230,14 +231,14 @@ int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
gfp_t mask); gfp_t mask);
int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int clear_bits, unsigned long bits, unsigned long clear_bits,
struct extent_state **cached_state, gfp_t mask); struct extent_state **cached_state, gfp_t mask);
int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached_state, gfp_t mask); struct extent_state **cached_state, gfp_t mask);
int set_extent_defrag(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_defrag(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached_state, gfp_t mask); struct extent_state **cached_state, gfp_t mask);
int find_first_extent_bit(struct extent_io_tree *tree, u64 start, int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
u64 *start_ret, u64 *end_ret, int bits, u64 *start_ret, u64 *end_ret, unsigned long bits,
struct extent_state **cached_state); struct extent_state **cached_state);
int extent_invalidatepage(struct extent_io_tree *tree, int extent_invalidatepage(struct extent_io_tree *tree,
struct page *page, unsigned long offset); struct page *page, unsigned long offset);
......
...@@ -1530,7 +1530,7 @@ static void btrfs_merge_extent_hook(struct inode *inode, ...@@ -1530,7 +1530,7 @@ static void btrfs_merge_extent_hook(struct inode *inode,
* have pending delalloc work to be done. * have pending delalloc work to be done.
*/ */
static void btrfs_set_bit_hook(struct inode *inode, static void btrfs_set_bit_hook(struct inode *inode,
struct extent_state *state, int *bits) struct extent_state *state, unsigned long *bits)
{ {
/* /*
...@@ -1574,7 +1574,8 @@ static void btrfs_set_bit_hook(struct inode *inode, ...@@ -1574,7 +1574,8 @@ static void btrfs_set_bit_hook(struct inode *inode,
* extent_io.c clear_bit_hook, see set_bit_hook for why * extent_io.c clear_bit_hook, see set_bit_hook for why
*/ */
static void btrfs_clear_bit_hook(struct inode *inode, static void btrfs_clear_bit_hook(struct inode *inode,
struct extent_state *state, int *bits) struct extent_state *state,
unsigned long *bits)
{ {
/* /*
* set_bit and clear bit hooks normally require _irqsave/restore * set_bit and clear bit hooks normally require _irqsave/restore
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment