aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.de>2011-07-21 12:56:09 -0400
committerChris Mason <chris.mason@oracle.com>2011-08-01 14:30:43 -0400
commit1bf85046e493c88be1c1bad9084428373089f618 (patch)
treee7358cb2dd597c8be7001be4573fa0e53361ebb5 /fs/btrfs/inode.c
parentb6973aa62253f3791ef6fa5e9f9de099645fc2bd (diff)
btrfs: Make extent-io callbacks that never fail return void
The set/clear bit and the extent split/merge hooks only ever return 0. Changing them to return void simplifies the error handling cases later. This patch changes the hook prototypes, the single implementation of each, and the functions that call them to return void instead. Since all four of these hooks execute under a spinlock, they're necessarily simple. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 69e448eddf0..34195f9fc6b 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1283,17 +1283,16 @@ static int run_delalloc_range(struct inode *inode, struct page *locked_page,
1283 return ret; 1283 return ret;
1284} 1284}
1285 1285
1286static int btrfs_split_extent_hook(struct inode *inode, 1286static void btrfs_split_extent_hook(struct inode *inode,
1287 struct extent_state *orig, u64 split) 1287 struct extent_state *orig, u64 split)
1288{ 1288{
1289 /* not delalloc, ignore it */ 1289 /* not delalloc, ignore it */
1290 if (!(orig->state & EXTENT_DELALLOC)) 1290 if (!(orig->state & EXTENT_DELALLOC))
1291 return 0; 1291 return;
1292 1292
1293 spin_lock(&BTRFS_I(inode)->lock); 1293 spin_lock(&BTRFS_I(inode)->lock);
1294 BTRFS_I(inode)->outstanding_extents++; 1294 BTRFS_I(inode)->outstanding_extents++;
1295 spin_unlock(&BTRFS_I(inode)->lock); 1295 spin_unlock(&BTRFS_I(inode)->lock);
1296 return 0;
1297} 1296}
1298 1297
1299/* 1298/*
@@ -1302,18 +1301,17 @@ static int btrfs_split_extent_hook(struct inode *inode,
1302 * extents, such as when we are doing sequential writes, so we can properly 1301 * extents, such as when we are doing sequential writes, so we can properly
1303 * account for the metadata space we'll need. 1302 * account for the metadata space we'll need.
1304 */ 1303 */
1305static int btrfs_merge_extent_hook(struct inode *inode, 1304static void btrfs_merge_extent_hook(struct inode *inode,
1306 struct extent_state *new, 1305 struct extent_state *new,
1307 struct extent_state *other) 1306 struct extent_state *other)
1308{ 1307{
1309 /* not delalloc, ignore it */ 1308 /* not delalloc, ignore it */
1310 if (!(other->state & EXTENT_DELALLOC)) 1309 if (!(other->state & EXTENT_DELALLOC))
1311 return 0; 1310 return;
1312 1311
1313 spin_lock(&BTRFS_I(inode)->lock); 1312 spin_lock(&BTRFS_I(inode)->lock);
1314 BTRFS_I(inode)->outstanding_extents--; 1313 BTRFS_I(inode)->outstanding_extents--;
1315 spin_unlock(&BTRFS_I(inode)->lock); 1314 spin_unlock(&BTRFS_I(inode)->lock);
1316 return 0;
1317} 1315}
1318 1316
1319/* 1317/*
@@ -1321,8 +1319,8 @@ static int btrfs_merge_extent_hook(struct inode *inode,
1321 * bytes in this file, and to maintain the list of inodes that 1319 * bytes in this file, and to maintain the list of inodes that
1322 * have pending delalloc work to be done. 1320 * have pending delalloc work to be done.
1323 */ 1321 */
1324static int btrfs_set_bit_hook(struct inode *inode, 1322static void btrfs_set_bit_hook(struct inode *inode,
1325 struct extent_state *state, int *bits) 1323 struct extent_state *state, int *bits)
1326{ 1324{
1327 1325
1328 /* 1326 /*
@@ -1352,14 +1350,13 @@ static int btrfs_set_bit_hook(struct inode *inode,
1352 } 1350 }
1353 spin_unlock(&root->fs_info->delalloc_lock); 1351 spin_unlock(&root->fs_info->delalloc_lock);
1354 } 1352 }
1355 return 0;
1356} 1353}
1357 1354
1358/* 1355/*
1359 * extent_io.c clear_bit_hook, see set_bit_hook for why 1356 * extent_io.c clear_bit_hook, see set_bit_hook for why
1360 */ 1357 */
1361static int btrfs_clear_bit_hook(struct inode *inode, 1358static void btrfs_clear_bit_hook(struct inode *inode,
1362 struct extent_state *state, int *bits) 1359 struct extent_state *state, int *bits)
1363{ 1360{
1364 /* 1361 /*
1365 * set_bit and clear bit hooks normally require _irqsave/restore 1362 * set_bit and clear bit hooks normally require _irqsave/restore
@@ -1396,7 +1393,6 @@ static int btrfs_clear_bit_hook(struct inode *inode,
1396 } 1393 }
1397 spin_unlock(&root->fs_info->delalloc_lock); 1394 spin_unlock(&root->fs_info->delalloc_lock);
1398 } 1395 }
1399 return 0;
1400} 1396}
1401 1397
1402/* 1398/*