aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2013-12-04 20:34:29 +0900
committerDaniel Phillips <daniel@tux3.org>2013-12-04 20:34:29 +0900
commit8e29513e2ceb618e6d9443138c7c7e522e32ec30 (patch)
treef93681e5ceb377fb7541a118978d73fcf1df6485
parentec77ebbf001200342df46905c22aacc07680095e (diff)
downloadlinux-tux3-8e29513e2ceb618e6d9443138c7c7e522e32ec30.tar.gz
tux3: Optimize split position for append write in dleaf2_write()
Append write is common operation, and if append write, split at center is not optimal for leaf split. So, this splits leaf at sentinel, if leaf is most right and key is >= sentinel. FIXME1: we should apply this for bnode too. FIXME2: this changes split position only if most right leaf. Should we split at sentinel by filling hole too? Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r--fs/tux3/dleaf2.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/tux3/dleaf2.c b/fs/tux3/dleaf2.c
index c1fdc04e2fe76..fa424c6635764 100644
--- a/fs/tux3/dleaf2.c
+++ b/fs/tux3/dleaf2.c
@@ -679,6 +679,21 @@ static int dleaf2_write(struct btree *btree, tuxkey_t key_bottom,
return 0;
need_split:
+ /* FIXME: do we should split at sentinel when filling hole? */
+ if (key_limit == TUXKEY_LIMIT) {
+ struct diskextent2 *sentinel =
+ dleaf->table + be16_to_cpu(dleaf->count) - 1;
+
+ /* If append write, split at sentinel */
+ *split_hint = get_logical(sentinel);
+ if (key->start >= *split_hint) {
+ tux3_dbg("key %Lu bottom %Lu, limit %Lu, hint %Lu",
+ key->start, key_bottom, key_limit,
+ *split_hint);
+ return 1;
+ }
+ }
+
/* FIXME: use better split position */
*split_hint = dleaf2_split_at_center(dleaf);
return 1; /* try to split dleaf2 */