aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2014-01-23 04:07:32 +0900
committerDaniel Phillips <daniel@tux3.org>2014-01-23 04:07:32 +0900
commit883a696dd21045bc94c9807957e55311faaf148d (patch)
tree9cbd823440af82ef1cdc6c3e368fdc85a9040d40
parent50ade99554a9a89ea2e37c7c63ad10a21e1acfa0 (diff)
downloadlinux-tux3-883a696dd21045bc94c9807957e55311faaf148d.tar.gz
tux3: Use bfree_segs() to free multiple segments at once
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r--fs/tux3/filemap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/tux3/filemap.c b/fs/tux3/filemap.c
index 73d9db42e62cb1..f86c6f1f30dc26 100644
--- a/fs/tux3/filemap.c
+++ b/fs/tux3/filemap.c
@@ -397,9 +397,8 @@ static int seg_find(struct btree *btree, struct dleaf_req *rq,
seg->state = seg_state;
}
if (err) {
- struct block_segment *p;
- for (p = rq->seg + rq->seg_idx; p < seg; p++)
- bfree(sb, p->block, p->count);
+ struct block_segment *p = rq->seg + rq->seg_idx;
+ bfree_segs(sb, p, seg - p);
return err;
}
@@ -427,9 +426,11 @@ static int seg_alloc(struct btree *btree, struct dleaf_req *rq,
seg_len -= seg->count;
} else {
/* FIXME: replace with balloc_modify() */
- bfree(sb, seg->block, seg->count);
+ int segs = limit - seg;
+ bfree_segs(sb, seg, segs); /* FIXME: error handling */
sb->nextblock = seg->block;
- rq->seg_cnt--;
+ rq->seg_cnt -= segs;
+ break;
}
seg++;
}