diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-10-03 11:10:41 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-10-03 11:10:41 -0400 |
commit | ddacfaf76dd620af9b73343a975749778321b51c (patch) | |
tree | 1199c2a78b5e2cdd6efc6965dd4cd8caa00ec482 /fs/gfs2/log.c | |
parent | f92a0b6ff43e8e07bbd5b1d2dd1cff130014f3c7 (diff) |
[GFS2] Move logging code into log.c (mostly)
This moves the logging code from meta_io.c into log.c and glops.c. As a
result the routines can now be static and all the logging code is together
in log.c, leaving meta_io.c with just metadata i/o code in it.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/log.c')
-rw-r--r-- | fs/gfs2/log.c | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 6112d648b7ee..554fe5bd1b72 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -58,6 +58,90 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct, | |||
58 | return blks; | 58 | return blks; |
59 | } | 59 | } |
60 | 60 | ||
61 | /** | ||
62 | * gfs2_ail1_start_one - Start I/O on a part of the AIL | ||
63 | * @sdp: the filesystem | ||
64 | * @tr: the part of the AIL | ||
65 | * | ||
66 | */ | ||
67 | |||
68 | static void gfs2_ail1_start_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai) | ||
69 | { | ||
70 | struct gfs2_bufdata *bd, *s; | ||
71 | struct buffer_head *bh; | ||
72 | int retry; | ||
73 | |||
74 | BUG_ON(!spin_is_locked(&sdp->sd_log_lock)); | ||
75 | |||
76 | do { | ||
77 | retry = 0; | ||
78 | |||
79 | list_for_each_entry_safe_reverse(bd, s, &ai->ai_ail1_list, | ||
80 | bd_ail_st_list) { | ||
81 | bh = bd->bd_bh; | ||
82 | |||
83 | gfs2_assert(sdp, bd->bd_ail == ai); | ||
84 | |||
85 | if (!buffer_busy(bh)) { | ||
86 | if (!buffer_uptodate(bh)) { | ||
87 | gfs2_log_unlock(sdp); | ||
88 | gfs2_io_error_bh(sdp, bh); | ||
89 | gfs2_log_lock(sdp); | ||
90 | } | ||
91 | list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list); | ||
92 | continue; | ||
93 | } | ||
94 | |||
95 | if (!buffer_dirty(bh)) | ||
96 | continue; | ||
97 | |||
98 | list_move(&bd->bd_ail_st_list, &ai->ai_ail1_list); | ||
99 | |||
100 | gfs2_log_unlock(sdp); | ||
101 | wait_on_buffer(bh); | ||
102 | ll_rw_block(WRITE, 1, &bh); | ||
103 | gfs2_log_lock(sdp); | ||
104 | |||
105 | retry = 1; | ||
106 | break; | ||
107 | } | ||
108 | } while (retry); | ||
109 | } | ||
110 | |||
111 | /** | ||
112 | * gfs2_ail1_empty_one - Check whether or not a trans in the AIL has been synced | ||
113 | * @sdp: the filesystem | ||
114 | * @ai: the AIL entry | ||
115 | * | ||
116 | */ | ||
117 | |||
118 | static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai, int flags) | ||
119 | { | ||
120 | struct gfs2_bufdata *bd, *s; | ||
121 | struct buffer_head *bh; | ||
122 | |||
123 | list_for_each_entry_safe_reverse(bd, s, &ai->ai_ail1_list, | ||
124 | bd_ail_st_list) { | ||
125 | bh = bd->bd_bh; | ||
126 | |||
127 | gfs2_assert(sdp, bd->bd_ail == ai); | ||
128 | |||
129 | if (buffer_busy(bh)) { | ||
130 | if (flags & DIO_ALL) | ||
131 | continue; | ||
132 | else | ||
133 | break; | ||
134 | } | ||
135 | |||
136 | if (!buffer_uptodate(bh)) | ||
137 | gfs2_io_error_bh(sdp, bh); | ||
138 | |||
139 | list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list); | ||
140 | } | ||
141 | |||
142 | return list_empty(&ai->ai_ail1_list); | ||
143 | } | ||
144 | |||
61 | void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags) | 145 | void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags) |
62 | { | 146 | { |
63 | struct list_head *head = &sdp->sd_ail1_list; | 147 | struct list_head *head = &sdp->sd_ail1_list; |
@@ -121,6 +205,31 @@ int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags) | |||
121 | return ret; | 205 | return ret; |
122 | } | 206 | } |
123 | 207 | ||
208 | |||
209 | /** | ||
210 | * gfs2_ail2_empty_one - Check whether or not a trans in the AIL has been synced | ||
211 | * @sdp: the filesystem | ||
212 | * @ai: the AIL entry | ||
213 | * | ||
214 | */ | ||
215 | |||
216 | static void gfs2_ail2_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai) | ||
217 | { | ||
218 | struct list_head *head = &ai->ai_ail2_list; | ||
219 | struct gfs2_bufdata *bd; | ||
220 | |||
221 | while (!list_empty(head)) { | ||
222 | bd = list_entry(head->prev, struct gfs2_bufdata, | ||
223 | bd_ail_st_list); | ||
224 | gfs2_assert(sdp, bd->bd_ail == ai); | ||
225 | bd->bd_ail = NULL; | ||
226 | list_del(&bd->bd_ail_st_list); | ||
227 | list_del(&bd->bd_ail_gl_list); | ||
228 | atomic_dec(&bd->bd_gl->gl_ail_count); | ||
229 | brelse(bd->bd_bh); | ||
230 | } | ||
231 | } | ||
232 | |||
124 | static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail) | 233 | static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail) |
125 | { | 234 | { |
126 | struct gfs2_ail *ai, *safe; | 235 | struct gfs2_ail *ai, *safe; |