diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-13 13:32:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-13 13:32:24 -0400 |
commit | 33a538833f1dc46965d11cff1efa756702a9b138 (patch) | |
tree | 7d3c91618422f263356d28ade3c179c92c3c02c1 /fs | |
parent | 3c25fa740e2084a3950f581378ec29a3c307ddfc (diff) | |
parent | 071d73cfe5c38cf62338b952bd350ff3de541b75 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2:
nilfs2: fix problem in setting checkpoint interval
nilfs2: fix missing block address termination in btree node shrinking
nilfs2: fix incorrect block address termination in node concatenation
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nilfs2/btree.c | 39 | ||||
-rw-r--r-- | fs/nilfs2/segment.c | 2 |
2 files changed, 28 insertions, 13 deletions
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 7eafe468a29c..b2e3ff347620 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
@@ -1346,6 +1346,11 @@ static void nilfs_btree_shrink(struct nilfs_bmap *btree, | |||
1346 | path[level].bp_bh = NULL; | 1346 | path[level].bp_bh = NULL; |
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | static void nilfs_btree_nop(struct nilfs_bmap *btree, | ||
1350 | struct nilfs_btree_path *path, | ||
1351 | int level, __u64 *keyp, __u64 *ptrp) | ||
1352 | { | ||
1353 | } | ||
1349 | 1354 | ||
1350 | static int nilfs_btree_prepare_delete(struct nilfs_bmap *btree, | 1355 | static int nilfs_btree_prepare_delete(struct nilfs_bmap *btree, |
1351 | struct nilfs_btree_path *path, | 1356 | struct nilfs_btree_path *path, |
@@ -1356,20 +1361,19 @@ static int nilfs_btree_prepare_delete(struct nilfs_bmap *btree, | |||
1356 | struct buffer_head *bh; | 1361 | struct buffer_head *bh; |
1357 | struct nilfs_btree_node *node, *parent, *sib; | 1362 | struct nilfs_btree_node *node, *parent, *sib; |
1358 | __u64 sibptr; | 1363 | __u64 sibptr; |
1359 | int pindex, level, ncmin, ncmax, ncblk, ret; | 1364 | int pindex, dindex, level, ncmin, ncmax, ncblk, ret; |
1360 | 1365 | ||
1361 | ret = 0; | 1366 | ret = 0; |
1362 | stats->bs_nblocks = 0; | 1367 | stats->bs_nblocks = 0; |
1363 | ncmin = NILFS_BTREE_NODE_NCHILDREN_MIN(nilfs_btree_node_size(btree)); | 1368 | ncmin = NILFS_BTREE_NODE_NCHILDREN_MIN(nilfs_btree_node_size(btree)); |
1364 | ncblk = nilfs_btree_nchildren_per_block(btree); | 1369 | ncblk = nilfs_btree_nchildren_per_block(btree); |
1365 | 1370 | ||
1366 | for (level = NILFS_BTREE_LEVEL_NODE_MIN; | 1371 | for (level = NILFS_BTREE_LEVEL_NODE_MIN, dindex = path[level].bp_index; |
1367 | level < nilfs_btree_height(btree) - 1; | 1372 | level < nilfs_btree_height(btree) - 1; |
1368 | level++) { | 1373 | level++) { |
1369 | node = nilfs_btree_get_nonroot_node(path, level); | 1374 | node = nilfs_btree_get_nonroot_node(path, level); |
1370 | path[level].bp_oldreq.bpr_ptr = | 1375 | path[level].bp_oldreq.bpr_ptr = |
1371 | nilfs_btree_node_get_ptr(node, path[level].bp_index, | 1376 | nilfs_btree_node_get_ptr(node, dindex, ncblk); |
1372 | ncblk); | ||
1373 | ret = nilfs_bmap_prepare_end_ptr(btree, | 1377 | ret = nilfs_bmap_prepare_end_ptr(btree, |
1374 | &path[level].bp_oldreq, dat); | 1378 | &path[level].bp_oldreq, dat); |
1375 | if (ret < 0) | 1379 | if (ret < 0) |
@@ -1383,6 +1387,7 @@ static int nilfs_btree_prepare_delete(struct nilfs_bmap *btree, | |||
1383 | 1387 | ||
1384 | parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); | 1388 | parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); |
1385 | pindex = path[level + 1].bp_index; | 1389 | pindex = path[level + 1].bp_index; |
1390 | dindex = pindex; | ||
1386 | 1391 | ||
1387 | if (pindex > 0) { | 1392 | if (pindex > 0) { |
1388 | /* left sibling */ | 1393 | /* left sibling */ |
@@ -1421,6 +1426,14 @@ static int nilfs_btree_prepare_delete(struct nilfs_bmap *btree, | |||
1421 | path[level].bp_sib_bh = bh; | 1426 | path[level].bp_sib_bh = bh; |
1422 | path[level].bp_op = nilfs_btree_concat_right; | 1427 | path[level].bp_op = nilfs_btree_concat_right; |
1423 | stats->bs_nblocks++; | 1428 | stats->bs_nblocks++; |
1429 | /* | ||
1430 | * When merging right sibling node | ||
1431 | * into the current node, pointer to | ||
1432 | * the right sibling node must be | ||
1433 | * terminated instead. The adjustment | ||
1434 | * below is required for that. | ||
1435 | */ | ||
1436 | dindex = pindex + 1; | ||
1424 | /* continue; */ | 1437 | /* continue; */ |
1425 | } | 1438 | } |
1426 | } else { | 1439 | } else { |
@@ -1431,29 +1444,31 @@ static int nilfs_btree_prepare_delete(struct nilfs_bmap *btree, | |||
1431 | NILFS_BTREE_ROOT_NCHILDREN_MAX) { | 1444 | NILFS_BTREE_ROOT_NCHILDREN_MAX) { |
1432 | path[level].bp_op = nilfs_btree_shrink; | 1445 | path[level].bp_op = nilfs_btree_shrink; |
1433 | stats->bs_nblocks += 2; | 1446 | stats->bs_nblocks += 2; |
1447 | level++; | ||
1448 | path[level].bp_op = nilfs_btree_nop; | ||
1449 | goto shrink_root_child; | ||
1434 | } else { | 1450 | } else { |
1435 | path[level].bp_op = nilfs_btree_do_delete; | 1451 | path[level].bp_op = nilfs_btree_do_delete; |
1436 | stats->bs_nblocks++; | 1452 | stats->bs_nblocks++; |
1453 | goto out; | ||
1437 | } | 1454 | } |
1438 | |||
1439 | goto out; | ||
1440 | |||
1441 | } | 1455 | } |
1442 | } | 1456 | } |
1443 | 1457 | ||
1458 | /* child of the root node is deleted */ | ||
1459 | path[level].bp_op = nilfs_btree_do_delete; | ||
1460 | stats->bs_nblocks++; | ||
1461 | |||
1462 | shrink_root_child: | ||
1444 | node = nilfs_btree_get_root(btree); | 1463 | node = nilfs_btree_get_root(btree); |
1445 | path[level].bp_oldreq.bpr_ptr = | 1464 | path[level].bp_oldreq.bpr_ptr = |
1446 | nilfs_btree_node_get_ptr(node, path[level].bp_index, | 1465 | nilfs_btree_node_get_ptr(node, dindex, |
1447 | NILFS_BTREE_ROOT_NCHILDREN_MAX); | 1466 | NILFS_BTREE_ROOT_NCHILDREN_MAX); |
1448 | 1467 | ||
1449 | ret = nilfs_bmap_prepare_end_ptr(btree, &path[level].bp_oldreq, dat); | 1468 | ret = nilfs_bmap_prepare_end_ptr(btree, &path[level].bp_oldreq, dat); |
1450 | if (ret < 0) | 1469 | if (ret < 0) |
1451 | goto err_out_child_node; | 1470 | goto err_out_child_node; |
1452 | 1471 | ||
1453 | /* child of the root node is deleted */ | ||
1454 | path[level].bp_op = nilfs_btree_do_delete; | ||
1455 | stats->bs_nblocks++; | ||
1456 | |||
1457 | /* success */ | 1472 | /* success */ |
1458 | out: | 1473 | out: |
1459 | *levelp = level; | 1474 | *levelp = level; |
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 141646e88fb5..bb24ab6c282f 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -2573,7 +2573,7 @@ static struct nilfs_sc_info *nilfs_segctor_new(struct super_block *sb, | |||
2573 | sci->sc_watermark = NILFS_SC_DEFAULT_WATERMARK; | 2573 | sci->sc_watermark = NILFS_SC_DEFAULT_WATERMARK; |
2574 | 2574 | ||
2575 | if (nilfs->ns_interval) | 2575 | if (nilfs->ns_interval) |
2576 | sci->sc_interval = nilfs->ns_interval; | 2576 | sci->sc_interval = HZ * nilfs->ns_interval; |
2577 | if (nilfs->ns_watermark) | 2577 | if (nilfs->ns_watermark) |
2578 | sci->sc_watermark = nilfs->ns_watermark; | 2578 | sci->sc_watermark = nilfs->ns_watermark; |
2579 | return sci; | 2579 | return sci; |