aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/log.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2007-12-11 19:49:21 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2008-01-25 03:11:46 -0500
commitda6dd40d59fa9617ed697b90114e197036901632 (patch)
tree49e869021ed1f911bf3cdf185e9c4ce75c67f42a /fs/gfs2/log.c
parente9e1ef2b6ee401d7c1e1eb38052857b4b206d172 (diff)
[GFS2] Journal extent mapping
This patch saves a little time when gfs2 writes to the journals by keeping a mapping between logical and physical blocks on disk. That's better than constantly looking up indirect pointers in buffers, when the journals are several levels of indirection (which they typically are). Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/log.c')
-rw-r--r--fs/gfs2/log.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 14333d81cf7d..69a583ec43c7 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 3 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
4 * 4 *
5 * This copyrighted material is made available to anyone wishing to use, 5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions 6 * modify, copy, or redistribute it subject to the terms and conditions
@@ -339,18 +339,14 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
339 339
340static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) 340static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
341{ 341{
342 struct inode *inode = sdp->sd_jdesc->jd_inode; 342 struct gfs2_journal_extent *je;
343 int error; 343
344 struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; 344 list_for_each_entry(je, &sdp->sd_jdesc->extent_list, extent_list) {
345 345 if (lbn >= je->lblock && lbn < je->lblock + je->blocks)
346 bh_map.b_size = 1 << inode->i_blkbits; 346 return je->dblock + lbn;
347 error = gfs2_block_map(inode, lbn, &bh_map, 0); 347 }
348 if (error || !bh_map.b_blocknr) 348
349 printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, 349 return -1;
350 (unsigned long long)bh_map.b_blocknr, lbn);
351 gfs2_assert_withdraw(sdp, !error && bh_map.b_blocknr);
352
353 return bh_map.b_blocknr;
354} 350}
355 351
356/** 352/**