diff options
author | Bob Peterson <rpeterso@redhat.com> | 2008-01-28 12:20:10 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 05:39:54 -0400 |
commit | d0109bfa84d6603becac8c2e87b3716f557f2039 (patch) | |
tree | 6da41dae00d5784f4e52831d3d40629c1698b00a | |
parent | ca390601a8bbb4ab8301a9469d23cdb1cf77e7cb (diff) |
[GFS2] Only do lo_incore_commit once
This patch is performance related. When we're doing a log flush,
I noticed we were calling buf_lo_incore_commit twice: once for
data bufs and once for metadata bufs. Since this is the same
function and does the same thing in both cases, there should be
no reason to call it twice. Since we only need to call it once,
we can also make it faster by removing it from the generic "lops"
code and making it a stand-along static function.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/incore.h | 1 | ||||
-rw-r--r-- | fs/gfs2/log.c | 17 | ||||
-rw-r--r-- | fs/gfs2/lops.c | 17 | ||||
-rw-r--r-- | fs/gfs2/lops.h | 11 |
4 files changed, 17 insertions, 29 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 43472baa92e7..7ae12d2b6262 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -44,7 +44,6 @@ struct gfs2_log_header_host { | |||
44 | 44 | ||
45 | struct gfs2_log_operations { | 45 | struct gfs2_log_operations { |
46 | void (*lo_add) (struct gfs2_sbd *sdp, struct gfs2_log_element *le); | 46 | void (*lo_add) (struct gfs2_sbd *sdp, struct gfs2_log_element *le); |
47 | void (*lo_incore_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr); | ||
48 | void (*lo_before_commit) (struct gfs2_sbd *sdp); | 47 | void (*lo_before_commit) (struct gfs2_sbd *sdp); |
49 | void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_ail *ai); | 48 | void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_ail *ai); |
50 | void (*lo_before_scan) (struct gfs2_jdesc *jd, | 49 | void (*lo_before_scan) (struct gfs2_jdesc *jd, |
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 161ab6f2058e..b335304fc5d6 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -779,6 +779,21 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | |||
779 | gfs2_log_unlock(sdp); | 779 | gfs2_log_unlock(sdp); |
780 | } | 780 | } |
781 | 781 | ||
782 | static void buf_lo_incore_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | ||
783 | { | ||
784 | struct list_head *head = &tr->tr_list_buf; | ||
785 | struct gfs2_bufdata *bd; | ||
786 | |||
787 | gfs2_log_lock(sdp); | ||
788 | while (!list_empty(head)) { | ||
789 | bd = list_entry(head->next, struct gfs2_bufdata, bd_list_tr); | ||
790 | list_del_init(&bd->bd_list_tr); | ||
791 | tr->tr_num_buf--; | ||
792 | } | ||
793 | gfs2_log_unlock(sdp); | ||
794 | gfs2_assert_warn(sdp, !tr->tr_num_buf); | ||
795 | } | ||
796 | |||
782 | /** | 797 | /** |
783 | * gfs2_log_commit - Commit a transaction to the log | 798 | * gfs2_log_commit - Commit a transaction to the log |
784 | * @sdp: the filesystem | 799 | * @sdp: the filesystem |
@@ -790,7 +805,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | |||
790 | void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | 805 | void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
791 | { | 806 | { |
792 | log_refund(sdp, tr); | 807 | log_refund(sdp, tr); |
793 | lops_incore_commit(sdp, tr); | 808 | buf_lo_incore_commit(sdp, tr); |
794 | 809 | ||
795 | sdp->sd_vfs->s_dirt = 1; | 810 | sdp->sd_vfs->s_dirt = 1; |
796 | up_read(&sdp->sd_log_flush_lock); | 811 | up_read(&sdp->sd_log_flush_lock); |
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index fae59d69d01a..71387372c883 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -152,21 +152,6 @@ out: | |||
152 | unlock_buffer(bd->bd_bh); | 152 | unlock_buffer(bd->bd_bh); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void buf_lo_incore_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) | ||
156 | { | ||
157 | struct list_head *head = &tr->tr_list_buf; | ||
158 | struct gfs2_bufdata *bd; | ||
159 | |||
160 | gfs2_log_lock(sdp); | ||
161 | while (!list_empty(head)) { | ||
162 | bd = list_entry(head->next, struct gfs2_bufdata, bd_list_tr); | ||
163 | list_del_init(&bd->bd_list_tr); | ||
164 | tr->tr_num_buf--; | ||
165 | } | ||
166 | gfs2_log_unlock(sdp); | ||
167 | gfs2_assert_warn(sdp, !tr->tr_num_buf); | ||
168 | } | ||
169 | |||
170 | static void buf_lo_before_commit(struct gfs2_sbd *sdp) | 155 | static void buf_lo_before_commit(struct gfs2_sbd *sdp) |
171 | { | 156 | { |
172 | struct buffer_head *bh; | 157 | struct buffer_head *bh; |
@@ -737,7 +722,6 @@ static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) | |||
737 | 722 | ||
738 | const struct gfs2_log_operations gfs2_buf_lops = { | 723 | const struct gfs2_log_operations gfs2_buf_lops = { |
739 | .lo_add = buf_lo_add, | 724 | .lo_add = buf_lo_add, |
740 | .lo_incore_commit = buf_lo_incore_commit, | ||
741 | .lo_before_commit = buf_lo_before_commit, | 725 | .lo_before_commit = buf_lo_before_commit, |
742 | .lo_after_commit = buf_lo_after_commit, | 726 | .lo_after_commit = buf_lo_after_commit, |
743 | .lo_before_scan = buf_lo_before_scan, | 727 | .lo_before_scan = buf_lo_before_scan, |
@@ -763,7 +747,6 @@ const struct gfs2_log_operations gfs2_rg_lops = { | |||
763 | 747 | ||
764 | const struct gfs2_log_operations gfs2_databuf_lops = { | 748 | const struct gfs2_log_operations gfs2_databuf_lops = { |
765 | .lo_add = databuf_lo_add, | 749 | .lo_add = databuf_lo_add, |
766 | .lo_incore_commit = buf_lo_incore_commit, | ||
767 | .lo_before_commit = databuf_lo_before_commit, | 750 | .lo_before_commit = databuf_lo_before_commit, |
768 | .lo_after_commit = databuf_lo_after_commit, | 751 | .lo_after_commit = databuf_lo_after_commit, |
769 | .lo_scan_elements = databuf_lo_scan_elements, | 752 | .lo_scan_elements = databuf_lo_scan_elements, |
diff --git a/fs/gfs2/lops.h b/fs/gfs2/lops.h index 41a00df75587..3c0b2737658a 100644 --- a/fs/gfs2/lops.h +++ b/fs/gfs2/lops.h | |||
@@ -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-2008 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 |
@@ -57,15 +57,6 @@ static inline void lops_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | |||
57 | le->le_ops->lo_add(sdp, le); | 57 | le->le_ops->lo_add(sdp, le); |
58 | } | 58 | } |
59 | 59 | ||
60 | static inline void lops_incore_commit(struct gfs2_sbd *sdp, | ||
61 | struct gfs2_trans *tr) | ||
62 | { | ||
63 | int x; | ||
64 | for (x = 0; gfs2_log_ops[x]; x++) | ||
65 | if (gfs2_log_ops[x]->lo_incore_commit) | ||
66 | gfs2_log_ops[x]->lo_incore_commit(sdp, tr); | ||
67 | } | ||
68 | |||
69 | static inline void lops_before_commit(struct gfs2_sbd *sdp) | 60 | static inline void lops_before_commit(struct gfs2_sbd *sdp) |
70 | { | 61 | { |
71 | int x; | 62 | int x; |