aboutsummaryrefslogtreecommitdiff
path: root/drivers/md/bcache/extents.c
diff options
context:
space:
mode:
authorJohn Sheu <john.sheu@gmail.com>2014-03-17 23:13:56 -0700
committerKent Overstreet <kmo@daterainc.com>2014-03-18 12:39:28 -0700
commitcb85114956dc88b287afca2872658f562acbc302 (patch)
tree910dac3eecdcbbb70eb38ab88d71f309719f6e2d /drivers/md/bcache/extents.c
parent3a2fd9d5090b83aab85378a846fa10f39b0b5aa7 (diff)
bcache: remove nested function usage
Uninlined nested functions can cause crashes when using ftrace, as they don't follow the normal calling convention and confuse the ftrace function graph tracer as it examines the stack. Also, nested functions are supported as a gcc extension, but may fail on other compilers (e.g. llvm). Signed-off-by: John Sheu <john.sheu@gmail.com>
Diffstat (limited to 'drivers/md/bcache/extents.c')
-rw-r--r--drivers/md/bcache/extents.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c
index 35887330b49d..3a0de4cf9771 100644
--- a/drivers/md/bcache/extents.c
+++ b/drivers/md/bcache/extents.c
@@ -308,6 +308,16 @@ static struct bkey *bch_extent_sort_fixup(struct btree_iter *iter,
return NULL;
}
+static void bch_subtract_dirty(struct bkey *k,
+ struct cache_set *c,
+ uint64_t offset,
+ int sectors)
+{
+ if (KEY_DIRTY(k))
+ bcache_dev_sectors_dirty_add(c, KEY_INODE(k),
+ offset, -sectors);
+}
+
static bool bch_extent_insert_fixup(struct btree_keys *b,
struct bkey *insert,
struct btree_iter *iter,
@@ -315,13 +325,6 @@ static bool bch_extent_insert_fixup(struct btree_keys *b,
{
struct cache_set *c = container_of(b, struct btree, keys)->c;
- void subtract_dirty(struct bkey *k, uint64_t offset, int sectors)
- {
- if (KEY_DIRTY(k))
- bcache_dev_sectors_dirty_add(c, KEY_INODE(k),
- offset, -sectors);
- }
-
uint64_t old_offset;
unsigned old_size, sectors_found = 0;
@@ -398,7 +401,8 @@ static bool bch_extent_insert_fixup(struct btree_keys *b,
struct bkey *top;
- subtract_dirty(k, KEY_START(insert), KEY_SIZE(insert));
+ bch_subtract_dirty(k, c, KEY_START(insert),
+ KEY_SIZE(insert));
if (bkey_written(b, k)) {
/*
@@ -448,7 +452,7 @@ static bool bch_extent_insert_fixup(struct btree_keys *b,
}
}
- subtract_dirty(k, old_offset, old_size - KEY_SIZE(k));
+ bch_subtract_dirty(k, c, old_offset, old_size - KEY_SIZE(k));
}
check_failed: