blob: a0371f835cfb314dcfdd42a809294cfc9ebf2b9b [file] [log] [blame]
David Teiglandb3b94fa2006-01-16 16:50:04 +00001/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
Steven Whitehouse3a8a9a12006-05-18 15:09:15 -04003 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
David Teiglandb3b94fa2006-01-16 16:50:04 +00004 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
Steven Whitehousee9fc2aa2006-09-01 11:05:15 -04007 * of the GNU General Public License version 2.
David Teiglandb3b94fa2006-01-16 16:50:04 +00008 */
9
10#include <linux/sched.h>
11#include <linux/slab.h>
12#include <linux/spinlock.h>
13#include <linux/completion.h>
14#include <linux/buffer_head.h>
Steven Whitehouse5c676f62006-02-27 17:23:27 -050015#include <linux/gfs2_ondisk.h>
Fabio Massimo Di Nitto7d308592006-09-19 07:56:29 +020016#include <linux/lm_interface.h>
David Teiglandb3b94fa2006-01-16 16:50:04 +000017
18#include "gfs2.h"
Steven Whitehouse5c676f62006-02-27 17:23:27 -050019#include "incore.h"
Robert Peterson2332c442007-06-18 14:50:20 -050020#include "inode.h"
David Teiglandb3b94fa2006-01-16 16:50:04 +000021#include "glock.h"
22#include "log.h"
23#include "lops.h"
24#include "meta_io.h"
25#include "recovery.h"
26#include "rgrp.h"
27#include "trans.h"
Steven Whitehouse5c676f62006-02-27 17:23:27 -050028#include "util.h"
David Teiglandb3b94fa2006-01-16 16:50:04 +000029
30static void glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
31{
32 struct gfs2_glock *gl;
Steven Whitehouse5c676f62006-02-27 17:23:27 -050033 struct gfs2_trans *tr = current->journal_info;
David Teiglandb3b94fa2006-01-16 16:50:04 +000034
Steven Whitehouse5c676f62006-02-27 17:23:27 -050035 tr->tr_touched = 1;
David Teiglandb3b94fa2006-01-16 16:50:04 +000036
David Teiglandb3b94fa2006-01-16 16:50:04 +000037 gl = container_of(le, struct gfs2_glock, gl_le);
38 if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(gl)))
39 return;
David Teiglandb3b94fa2006-01-16 16:50:04 +000040
41 gfs2_log_lock(sdp);
Benjamin Marzinski68835622007-03-23 09:05:12 +000042 if (!list_empty(&le->le_list)){
43 gfs2_log_unlock(sdp);
44 return;
45 }
46 gfs2_glock_hold(gl);
47 set_bit(GLF_DIRTY, &gl->gl_flags);
David Teiglandb3b94fa2006-01-16 16:50:04 +000048 sdp->sd_log_num_gl++;
49 list_add(&le->le_list, &sdp->sd_log_le_gl);
50 gfs2_log_unlock(sdp);
51}
52
53static void glock_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
54{
55 struct list_head *head = &sdp->sd_log_le_gl;
56 struct gfs2_glock *gl;
57
58 while (!list_empty(head)) {
59 gl = list_entry(head->next, struct gfs2_glock, gl_le.le_list);
60 list_del_init(&gl->gl_le.le_list);
61 sdp->sd_log_num_gl--;
62
63 gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(gl));
64 gfs2_glock_put(gl);
65 }
66 gfs2_assert_warn(sdp, !sdp->sd_log_num_gl);
67}
68
69static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
70{
71 struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le);
72 struct gfs2_trans *tr;
73
Steven Whitehouse8bd95722007-01-25 10:04:20 +000074 gfs2_log_lock(sdp);
75 if (!list_empty(&bd->bd_list_tr)) {
76 gfs2_log_unlock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +000077 return;
Steven Whitehouse8bd95722007-01-25 10:04:20 +000078 }
Steven Whitehouse5c676f62006-02-27 17:23:27 -050079 tr = current->journal_info;
David Teiglandb3b94fa2006-01-16 16:50:04 +000080 tr->tr_touched = 1;
81 tr->tr_num_buf++;
82 list_add(&bd->bd_list_tr, &tr->tr_list_buf);
Steven Whitehouse8bd95722007-01-25 10:04:20 +000083 gfs2_log_unlock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +000084
85 if (!list_empty(&le->le_list))
86 return;
87
88 gfs2_trans_add_gl(bd->bd_gl);
89
90 gfs2_meta_check(sdp, bd->bd_bh);
Steven Whitehousea98ab222006-01-18 13:38:44 +000091 gfs2_pin(sdp, bd->bd_bh);
David Teiglandb3b94fa2006-01-16 16:50:04 +000092 gfs2_log_lock(sdp);
93 sdp->sd_log_num_buf++;
94 list_add(&le->le_list, &sdp->sd_log_le_buf);
95 gfs2_log_unlock(sdp);
96
97 tr->tr_num_buf_new++;
98}
99
100static void buf_lo_incore_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
101{
102 struct list_head *head = &tr->tr_list_buf;
103 struct gfs2_bufdata *bd;
104
Steven Whitehouse8bd95722007-01-25 10:04:20 +0000105 gfs2_log_lock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000106 while (!list_empty(head)) {
107 bd = list_entry(head->next, struct gfs2_bufdata, bd_list_tr);
108 list_del_init(&bd->bd_list_tr);
109 tr->tr_num_buf--;
110 }
Steven Whitehouse8bd95722007-01-25 10:04:20 +0000111 gfs2_log_unlock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000112 gfs2_assert_warn(sdp, !tr->tr_num_buf);
113}
114
115static void buf_lo_before_commit(struct gfs2_sbd *sdp)
116{
117 struct buffer_head *bh;
118 struct gfs2_log_descriptor *ld;
119 struct gfs2_bufdata *bd1 = NULL, *bd2;
Bob Peterson905d2ae2007-07-24 14:05:31 -0500120 unsigned int total;
Robert Peterson2332c442007-06-18 14:50:20 -0500121 unsigned int offset = BUF_OFFSET;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000122 unsigned int limit;
123 unsigned int num;
124 unsigned n;
125 __be64 *ptr;
126
Robert Peterson2332c442007-06-18 14:50:20 -0500127 limit = buf_limit(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000128 /* for 4k blocks, limit = 503 */
129
Bob Peterson905d2ae2007-07-24 14:05:31 -0500130 gfs2_log_lock(sdp);
131 total = sdp->sd_log_num_buf;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000132 bd1 = bd2 = list_prepare_entry(bd1, &sdp->sd_log_le_buf, bd_le.le_list);
133 while(total) {
134 num = total;
135 if (total > limit)
136 num = limit;
Bob Peterson905d2ae2007-07-24 14:05:31 -0500137 gfs2_log_unlock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000138 bh = gfs2_log_get_buf(sdp);
Bob Peterson905d2ae2007-07-24 14:05:31 -0500139 gfs2_log_lock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000140 ld = (struct gfs2_log_descriptor *)bh->b_data;
141 ptr = (__be64 *)(bh->b_data + offset);
142 ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
Steven Whitehousee3167de2006-03-30 15:46:23 -0500143 ld->ld_header.mh_type = cpu_to_be32(GFS2_METATYPE_LD);
144 ld->ld_header.mh_format = cpu_to_be32(GFS2_FORMAT_LD);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000145 ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_METADATA);
146 ld->ld_length = cpu_to_be32(num + 1);
147 ld->ld_data1 = cpu_to_be32(num);
148 ld->ld_data2 = cpu_to_be32(0);
149 memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved));
150
151 n = 0;
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500152 list_for_each_entry_continue(bd1, &sdp->sd_log_le_buf,
153 bd_le.le_list) {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000154 *ptr++ = cpu_to_be64(bd1->bd_bh->b_blocknr);
155 if (++n >= num)
156 break;
157 }
158
Bob Peterson905d2ae2007-07-24 14:05:31 -0500159 gfs2_log_unlock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000160 set_buffer_dirty(bh);
161 ll_rw_block(WRITE, 1, &bh);
Bob Peterson905d2ae2007-07-24 14:05:31 -0500162 gfs2_log_lock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000163
164 n = 0;
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500165 list_for_each_entry_continue(bd2, &sdp->sd_log_le_buf,
166 bd_le.le_list) {
Bob Peterson905d2ae2007-07-24 14:05:31 -0500167 gfs2_log_unlock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000168 bh = gfs2_log_fake_buf(sdp, bd2->bd_bh);
169 set_buffer_dirty(bh);
170 ll_rw_block(WRITE, 1, &bh);
Bob Peterson905d2ae2007-07-24 14:05:31 -0500171 gfs2_log_lock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000172 if (++n >= num)
173 break;
174 }
175
Bob Peterson905d2ae2007-07-24 14:05:31 -0500176 BUG_ON(total < num);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000177 total -= num;
178 }
Bob Peterson905d2ae2007-07-24 14:05:31 -0500179 gfs2_log_unlock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000180}
181
182static void buf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
183{
184 struct list_head *head = &sdp->sd_log_le_buf;
185 struct gfs2_bufdata *bd;
186
187 while (!list_empty(head)) {
188 bd = list_entry(head->next, struct gfs2_bufdata, bd_le.le_list);
189 list_del_init(&bd->bd_le.le_list);
190 sdp->sd_log_num_buf--;
191
Steven Whitehousea98ab222006-01-18 13:38:44 +0000192 gfs2_unpin(sdp, bd->bd_bh, ai);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000193 }
194 gfs2_assert_warn(sdp, !sdp->sd_log_num_buf);
195}
196
197static void buf_lo_before_scan(struct gfs2_jdesc *jd,
Al Viro55167622006-10-13 21:47:13 -0400198 struct gfs2_log_header_host *head, int pass)
David Teiglandb3b94fa2006-01-16 16:50:04 +0000199{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400200 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000201
202 if (pass != 0)
203 return;
204
205 sdp->sd_found_blocks = 0;
206 sdp->sd_replayed_blocks = 0;
207}
208
209static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
210 struct gfs2_log_descriptor *ld, __be64 *ptr,
211 int pass)
212{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400213 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
214 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
Steven Whitehouse5c676f62006-02-27 17:23:27 -0500215 struct gfs2_glock *gl = ip->i_gl;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000216 unsigned int blks = be32_to_cpu(ld->ld_data1);
217 struct buffer_head *bh_log, *bh_ip;
Steven Whitehousecd915492006-09-04 12:49:07 -0400218 u64 blkno;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000219 int error = 0;
220
221 if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_METADATA)
222 return 0;
223
224 gfs2_replay_incr_blk(sdp, &start);
225
226 for (; blks; gfs2_replay_incr_blk(sdp, &start), blks--) {
227 blkno = be64_to_cpu(*ptr++);
228
229 sdp->sd_found_blocks++;
230
231 if (gfs2_revoke_check(sdp, blkno, start))
232 continue;
233
234 error = gfs2_replay_read_block(jd, start, &bh_log);
Steven Whitehouse82ffa512006-09-04 14:47:06 -0400235 if (error)
236 return error;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000237
238 bh_ip = gfs2_meta_new(gl, blkno);
239 memcpy(bh_ip->b_data, bh_log->b_data, bh_log->b_size);
240
241 if (gfs2_meta_check(sdp, bh_ip))
242 error = -EIO;
243 else
244 mark_buffer_dirty(bh_ip);
245
246 brelse(bh_log);
247 brelse(bh_ip);
248
249 if (error)
250 break;
251
252 sdp->sd_replayed_blocks++;
253 }
254
255 return error;
256}
257
258static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
259{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400260 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
261 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000262
263 if (error) {
Steven Whitehouse7276b3b2006-09-21 17:05:23 -0400264 gfs2_meta_sync(ip->i_gl);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000265 return;
266 }
267 if (pass != 1)
268 return;
269
Steven Whitehouse7276b3b2006-09-21 17:05:23 -0400270 gfs2_meta_sync(ip->i_gl);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000271
272 fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n",
273 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks);
274}
275
276static void revoke_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
277{
278 struct gfs2_trans *tr;
279
Steven Whitehouse5c676f62006-02-27 17:23:27 -0500280 tr = current->journal_info;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000281 tr->tr_touched = 1;
282 tr->tr_num_revoke++;
283
284 gfs2_log_lock(sdp);
285 sdp->sd_log_num_revoke++;
286 list_add(&le->le_list, &sdp->sd_log_le_revoke);
287 gfs2_log_unlock(sdp);
288}
289
290static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
291{
292 struct gfs2_log_descriptor *ld;
293 struct gfs2_meta_header *mh;
294 struct buffer_head *bh;
295 unsigned int offset;
296 struct list_head *head = &sdp->sd_log_le_revoke;
297 struct gfs2_revoke *rv;
298
299 if (!sdp->sd_log_num_revoke)
300 return;
301
302 bh = gfs2_log_get_buf(sdp);
303 ld = (struct gfs2_log_descriptor *)bh->b_data;
304 ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
Steven Whitehousee3167de2006-03-30 15:46:23 -0500305 ld->ld_header.mh_type = cpu_to_be32(GFS2_METATYPE_LD);
306 ld->ld_header.mh_format = cpu_to_be32(GFS2_FORMAT_LD);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000307 ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_REVOKE);
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500308 ld->ld_length = cpu_to_be32(gfs2_struct2blk(sdp, sdp->sd_log_num_revoke,
Steven Whitehousecd915492006-09-04 12:49:07 -0400309 sizeof(u64)));
David Teiglandb3b94fa2006-01-16 16:50:04 +0000310 ld->ld_data1 = cpu_to_be32(sdp->sd_log_num_revoke);
311 ld->ld_data2 = cpu_to_be32(0);
312 memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved));
313 offset = sizeof(struct gfs2_log_descriptor);
314
315 while (!list_empty(head)) {
316 rv = list_entry(head->next, struct gfs2_revoke, rv_le.le_list);
Steven Whitehouse13538b82006-02-22 11:15:03 +0000317 list_del_init(&rv->rv_le.le_list);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000318 sdp->sd_log_num_revoke--;
319
Steven Whitehousecd915492006-09-04 12:49:07 -0400320 if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000321 set_buffer_dirty(bh);
322 ll_rw_block(WRITE, 1, &bh);
323
324 bh = gfs2_log_get_buf(sdp);
325 mh = (struct gfs2_meta_header *)bh->b_data;
326 mh->mh_magic = cpu_to_be32(GFS2_MAGIC);
Steven Whitehousee3167de2006-03-30 15:46:23 -0500327 mh->mh_type = cpu_to_be32(GFS2_METATYPE_LB);
328 mh->mh_format = cpu_to_be32(GFS2_FORMAT_LB);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000329 offset = sizeof(struct gfs2_meta_header);
330 }
331
332 *(__be64 *)(bh->b_data + offset) = cpu_to_be64(rv->rv_blkno);
333 kfree(rv);
334
Steven Whitehousecd915492006-09-04 12:49:07 -0400335 offset += sizeof(u64);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000336 }
337 gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke);
338
339 set_buffer_dirty(bh);
340 ll_rw_block(WRITE, 1, &bh);
341}
342
343static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
Al Viro55167622006-10-13 21:47:13 -0400344 struct gfs2_log_header_host *head, int pass)
David Teiglandb3b94fa2006-01-16 16:50:04 +0000345{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400346 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000347
348 if (pass != 0)
349 return;
350
351 sdp->sd_found_revokes = 0;
352 sdp->sd_replay_tail = head->lh_tail;
353}
354
355static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
356 struct gfs2_log_descriptor *ld, __be64 *ptr,
357 int pass)
358{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400359 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000360 unsigned int blks = be32_to_cpu(ld->ld_length);
361 unsigned int revokes = be32_to_cpu(ld->ld_data1);
362 struct buffer_head *bh;
363 unsigned int offset;
Steven Whitehousecd915492006-09-04 12:49:07 -0400364 u64 blkno;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000365 int first = 1;
366 int error;
367
368 if (pass != 0 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_REVOKE)
369 return 0;
370
371 offset = sizeof(struct gfs2_log_descriptor);
372
373 for (; blks; gfs2_replay_incr_blk(sdp, &start), blks--) {
374 error = gfs2_replay_read_block(jd, start, &bh);
375 if (error)
376 return error;
377
378 if (!first)
379 gfs2_metatype_check(sdp, bh, GFS2_METATYPE_LB);
380
Steven Whitehousecd915492006-09-04 12:49:07 -0400381 while (offset + sizeof(u64) <= sdp->sd_sb.sb_bsize) {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000382 blkno = be64_to_cpu(*(__be64 *)(bh->b_data + offset));
383
384 error = gfs2_revoke_add(sdp, blkno, start);
385 if (error < 0)
386 return error;
387 else if (error)
388 sdp->sd_found_revokes++;
389
390 if (!--revokes)
391 break;
Steven Whitehousecd915492006-09-04 12:49:07 -0400392 offset += sizeof(u64);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000393 }
394
395 brelse(bh);
396 offset = sizeof(struct gfs2_meta_header);
397 first = 0;
398 }
399
400 return 0;
401}
402
403static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
404{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400405 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000406
407 if (error) {
408 gfs2_revoke_clean(sdp);
409 return;
410 }
411 if (pass != 1)
412 return;
413
414 fs_info(sdp, "jid=%u: Found %u revoke tags\n",
415 jd->jd_jid, sdp->sd_found_revokes);
416
417 gfs2_revoke_clean(sdp);
418}
419
420static void rg_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
421{
422 struct gfs2_rgrpd *rgd;
Steven Whitehouse5c676f62006-02-27 17:23:27 -0500423 struct gfs2_trans *tr = current->journal_info;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000424
Steven Whitehouse5c676f62006-02-27 17:23:27 -0500425 tr->tr_touched = 1;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000426
David Teiglandb3b94fa2006-01-16 16:50:04 +0000427 rgd = container_of(le, struct gfs2_rgrpd, rd_le);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000428
429 gfs2_log_lock(sdp);
Benjamin Marzinski68835622007-03-23 09:05:12 +0000430 if (!list_empty(&le->le_list)){
431 gfs2_log_unlock(sdp);
432 return;
433 }
434 gfs2_rgrp_bh_hold(rgd);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000435 sdp->sd_log_num_rg++;
436 list_add(&le->le_list, &sdp->sd_log_le_rg);
Steven Whitehouse907b9bc2006-09-25 09:26:04 -0400437 gfs2_log_unlock(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000438}
439
440static void rg_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
441{
442 struct list_head *head = &sdp->sd_log_le_rg;
443 struct gfs2_rgrpd *rgd;
444
445 while (!list_empty(head)) {
446 rgd = list_entry(head->next, struct gfs2_rgrpd, rd_le.le_list);
447 list_del_init(&rgd->rd_le.le_list);
448 sdp->sd_log_num_rg--;
449
450 gfs2_rgrp_repolish_clones(rgd);
451 gfs2_rgrp_bh_put(rgd);
452 }
453 gfs2_assert_warn(sdp, !sdp->sd_log_num_rg);
454}
455
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000456/**
457 * databuf_lo_add - Add a databuf to the transaction.
458 *
459 * This is used in two distinct cases:
460 * i) In ordered write mode
461 * We put the data buffer on a list so that we can ensure that its
462 * synced to disk at the right time
463 * ii) In journaled data mode
464 * We need to journal the data block in the same way as metadata in
465 * the functions above. The difference is that here we have a tag
466 * which is two __be64's being the block number (as per meta data)
467 * and a flag which says whether the data block needs escaping or
468 * not. This means we need a new log entry for each 251 or so data
469 * blocks, which isn't an enormous overhead but twice as much as
470 * for normal metadata blocks.
471 */
David Teiglandb3b94fa2006-01-16 16:50:04 +0000472static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
473{
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000474 struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le);
Steven Whitehouse5c676f62006-02-27 17:23:27 -0500475 struct gfs2_trans *tr = current->journal_info;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000476 struct address_space *mapping = bd->bd_bh->b_page->mapping;
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400477 struct gfs2_inode *ip = GFS2_I(mapping->host);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000478
Steven Whitehouse8bd95722007-01-25 10:04:20 +0000479 gfs2_log_lock(sdp);
Robert Peterson2332c442007-06-18 14:50:20 -0500480 if (!list_empty(&bd->bd_list_tr)) {
481 gfs2_log_unlock(sdp);
482 return;
483 }
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000484 tr->tr_touched = 1;
Robert Peterson773ed1a2007-06-20 08:34:06 -0500485 if (gfs2_is_jdata(ip)) {
486 tr->tr_num_buf++;
487 list_add(&bd->bd_list_tr, &tr->tr_list_buf);
488 }
Robert Peterson2332c442007-06-18 14:50:20 -0500489 gfs2_log_unlock(sdp);
490 if (!list_empty(&le->le_list))
491 return;
492
Steven Whitehouseb61dde72006-06-19 10:51:11 -0400493 gfs2_trans_add_gl(bd->bd_gl);
Robert Peterson2332c442007-06-18 14:50:20 -0500494 if (gfs2_is_jdata(ip)) {
495 sdp->sd_log_num_jdata++;
496 gfs2_pin(sdp, bd->bd_bh);
497 tr->tr_num_databuf_new++;
Steven Whitehouse13538b82006-02-22 11:15:03 +0000498 }
Robert Peterson2332c442007-06-18 14:50:20 -0500499 gfs2_log_lock(sdp);
Bob Petersonbdcb8852007-07-11 15:55:23 -0500500 sdp->sd_log_num_databuf++;
Robert Peterson2332c442007-06-18 14:50:20 -0500501 list_add(&le->le_list, &sdp->sd_log_le_databuf);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000502 gfs2_log_unlock(sdp);
503}
504
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000505static int gfs2_check_magic(struct buffer_head *bh)
506{
507 struct page *page = bh->b_page;
508 void *kaddr;
509 __be32 *ptr;
510 int rv = 0;
511
512 kaddr = kmap_atomic(page, KM_USER0);
513 ptr = kaddr + bh_offset(bh);
514 if (*ptr == cpu_to_be32(GFS2_MAGIC))
515 rv = 1;
Russell Cattelanc312c4f2006-10-12 09:23:41 -0400516 kunmap_atomic(kaddr, KM_USER0);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000517
518 return rv;
519}
520
521/**
522 * databuf_lo_before_commit - Scan the data buffers, writing as we go
523 *
524 * Here we scan through the lists of buffers and make the assumption
525 * that any buffer thats been pinned is being journaled, and that
526 * any unpinned buffer is an ordered write data buffer and therefore
527 * will be written back rather than journaled.
528 */
David Teiglandb3b94fa2006-01-16 16:50:04 +0000529static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
530{
David Teiglandb3b94fa2006-01-16 16:50:04 +0000531 LIST_HEAD(started);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000532 struct gfs2_bufdata *bd1 = NULL, *bd2, *bdt;
Russell Cattelan70209332006-11-09 11:28:08 -0500533 struct buffer_head *bh = NULL,*bh1 = NULL;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000534 struct gfs2_log_descriptor *ld;
535 unsigned int limit;
Bob Petersonbdcb8852007-07-11 15:55:23 -0500536 unsigned int total_dbuf;
Bob Peterson905d2ae2007-07-24 14:05:31 -0500537 unsigned int total_jdata;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000538 unsigned int num, n;
Steven Whitehousef55ab262006-02-21 12:51:39 +0000539 __be64 *ptr = NULL;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000540
Robert Peterson2332c442007-06-18 14:50:20 -0500541 limit = databuf_limit(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000542
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000543 /*
544 * Start writing ordered buffers, write journaled buffers
545 * into the log along with a header
546 */
Steven Whitehousef55ab262006-02-21 12:51:39 +0000547 gfs2_log_lock(sdp);
Bob Petersonbdcb8852007-07-11 15:55:23 -0500548 total_dbuf = sdp->sd_log_num_databuf;
Bob Peterson905d2ae2007-07-24 14:05:31 -0500549 total_jdata = sdp->sd_log_num_jdata;
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500550 bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf,
551 bd_le.le_list);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000552 while(total_dbuf) {
553 num = total_jdata;
554 if (num > limit)
555 num = limit;
556 n = 0;
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500557 list_for_each_entry_safe_continue(bd1, bdt,
558 &sdp->sd_log_le_databuf,
559 bd_le.le_list) {
Russell Cattelan70209332006-11-09 11:28:08 -0500560 /* store off the buffer head in a local ptr since
561 * gfs2_bufdata might change when we drop the log lock
562 */
563 bh1 = bd1->bd_bh;
564
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000565 /* An ordered write buffer */
Russell Cattelan70209332006-11-09 11:28:08 -0500566 if (bh1 && !buffer_pinned(bh1)) {
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000567 list_move(&bd1->bd_le.le_list, &started);
568 if (bd1 == bd2) {
569 bd2 = NULL;
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500570 bd2 = list_prepare_entry(bd2,
571 &sdp->sd_log_le_databuf,
572 bd_le.le_list);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000573 }
574 total_dbuf--;
Russell Cattelan70209332006-11-09 11:28:08 -0500575 if (bh1) {
576 if (buffer_dirty(bh1)) {
577 get_bh(bh1);
578
Steven Whitehousef55ab262006-02-21 12:51:39 +0000579 gfs2_log_unlock(sdp);
Russell Cattelan70209332006-11-09 11:28:08 -0500580
581 ll_rw_block(SWRITE, 1, &bh1);
582 brelse(bh1);
583
Steven Whitehousef55ab262006-02-21 12:51:39 +0000584 gfs2_log_lock(sdp);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000585 }
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000586 continue;
587 }
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000588 continue;
Russell Cattelan70209332006-11-09 11:28:08 -0500589 } else if (bh1) { /* A journaled buffer */
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000590 int magic;
591 gfs2_log_unlock(sdp);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000592 if (!bh) {
593 bh = gfs2_log_get_buf(sdp);
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500594 ld = (struct gfs2_log_descriptor *)
595 bh->b_data;
Robert Peterson2332c442007-06-18 14:50:20 -0500596 ptr = (__be64 *)(bh->b_data +
597 DATABUF_OFFSET);
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500598 ld->ld_header.mh_magic =
599 cpu_to_be32(GFS2_MAGIC);
600 ld->ld_header.mh_type =
Steven Whitehousee3167de2006-03-30 15:46:23 -0500601 cpu_to_be32(GFS2_METATYPE_LD);
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500602 ld->ld_header.mh_format =
Steven Whitehousee3167de2006-03-30 15:46:23 -0500603 cpu_to_be32(GFS2_FORMAT_LD);
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500604 ld->ld_type =
605 cpu_to_be32(GFS2_LOG_DESC_JDATA);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000606 ld->ld_length = cpu_to_be32(num + 1);
607 ld->ld_data1 = cpu_to_be32(num);
608 ld->ld_data2 = cpu_to_be32(0);
609 memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved));
610 }
Russell Cattelan70209332006-11-09 11:28:08 -0500611 magic = gfs2_check_magic(bh1);
612 *ptr++ = cpu_to_be64(bh1->b_blocknr);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000613 *ptr++ = cpu_to_be64((__u64)magic);
Russell Cattelan70209332006-11-09 11:28:08 -0500614 clear_buffer_escaped(bh1);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000615 if (unlikely(magic != 0))
Russell Cattelan70209332006-11-09 11:28:08 -0500616 set_buffer_escaped(bh1);
Steven Whitehousef55ab262006-02-21 12:51:39 +0000617 gfs2_log_lock(sdp);
Robert Peterson2332c442007-06-18 14:50:20 -0500618 if (++n >= num)
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000619 break;
Russell Cattelan70209332006-11-09 11:28:08 -0500620 } else if (!bh1) {
Steven Whitehouse623d9352006-08-31 12:14:44 -0400621 total_dbuf--;
622 sdp->sd_log_num_databuf--;
623 list_del_init(&bd1->bd_le.le_list);
624 if (bd1 == bd2) {
625 bd2 = NULL;
626 bd2 = list_prepare_entry(bd2,
627 &sdp->sd_log_le_databuf,
628 bd_le.le_list);
629 }
630 kmem_cache_free(gfs2_bufdata_cachep, bd1);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000631 }
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000632 }
Steven Whitehousef55ab262006-02-21 12:51:39 +0000633 gfs2_log_unlock(sdp);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000634 if (bh) {
635 set_buffer_dirty(bh);
636 ll_rw_block(WRITE, 1, &bh);
637 bh = NULL;
Bob Peterson905d2ae2007-07-24 14:05:31 -0500638 ptr = NULL;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000639 }
640 n = 0;
Steven Whitehousef55ab262006-02-21 12:51:39 +0000641 gfs2_log_lock(sdp);
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500642 list_for_each_entry_continue(bd2, &sdp->sd_log_le_databuf,
643 bd_le.le_list) {
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000644 if (!bd2->bd_bh)
645 continue;
646 /* copy buffer if it needs escaping */
Steven Whitehousef55ab262006-02-21 12:51:39 +0000647 gfs2_log_unlock(sdp);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000648 if (unlikely(buffer_escaped(bd2->bd_bh))) {
649 void *kaddr;
650 struct page *page = bd2->bd_bh->b_page;
651 bh = gfs2_log_get_buf(sdp);
652 kaddr = kmap_atomic(page, KM_USER0);
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500653 memcpy(bh->b_data,
654 kaddr + bh_offset(bd2->bd_bh),
655 sdp->sd_sb.sb_bsize);
Russell Cattelanc312c4f2006-10-12 09:23:41 -0400656 kunmap_atomic(kaddr, KM_USER0);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000657 *(__be32 *)bh->b_data = 0;
658 } else {
659 bh = gfs2_log_fake_buf(sdp, bd2->bd_bh);
660 }
661 set_buffer_dirty(bh);
662 ll_rw_block(WRITE, 1, &bh);
Steven Whitehousef55ab262006-02-21 12:51:39 +0000663 gfs2_log_lock(sdp);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000664 if (++n >= num)
665 break;
666 }
667 bh = NULL;
Bob Petersonbdcb8852007-07-11 15:55:23 -0500668 BUG_ON(total_dbuf < num);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000669 total_dbuf -= num;
670 total_jdata -= num;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000671 }
Steven Whitehousef55ab262006-02-21 12:51:39 +0000672 gfs2_log_unlock(sdp);
673
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000674 /* Wait on all ordered buffers */
David Teiglandb3b94fa2006-01-16 16:50:04 +0000675 while (!list_empty(&started)) {
Steven Whitehouse13538b82006-02-22 11:15:03 +0000676 gfs2_log_lock(sdp);
Steven Whitehouse568f4c92006-02-27 12:00:42 -0500677 bd1 = list_entry(started.next, struct gfs2_bufdata,
678 bd_le.le_list);
Steven Whitehouse08867602006-08-22 11:03:57 -0400679 list_del_init(&bd1->bd_le.le_list);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000680 sdp->sd_log_num_databuf--;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000681 bh = bd1->bd_bh;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000682 if (bh) {
Steven Whitehouse5c676f62006-02-27 17:23:27 -0500683 bh->b_private = NULL;
Steven Whitehouse15d00c02006-08-18 15:51:09 -0400684 get_bh(bh);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000685 gfs2_log_unlock(sdp);
686 wait_on_buffer(bh);
687 brelse(bh);
688 } else
689 gfs2_log_unlock(sdp);
690
Steven Whitehouse3a8476d2006-06-19 09:10:39 -0400691 kmem_cache_free(gfs2_bufdata_cachep, bd1);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000692 }
693
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000694 /* We've removed all the ordered write bufs here, so only jdata left */
695 gfs2_assert_warn(sdp, sdp->sd_log_num_databuf == sdp->sd_log_num_jdata);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000696}
697
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000698static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
699 struct gfs2_log_descriptor *ld,
700 __be64 *ptr, int pass)
701{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400702 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
703 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
Steven Whitehouse5c676f62006-02-27 17:23:27 -0500704 struct gfs2_glock *gl = ip->i_gl;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000705 unsigned int blks = be32_to_cpu(ld->ld_data1);
706 struct buffer_head *bh_log, *bh_ip;
Steven Whitehousecd915492006-09-04 12:49:07 -0400707 u64 blkno;
708 u64 esc;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000709 int error = 0;
710
711 if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_JDATA)
712 return 0;
713
714 gfs2_replay_incr_blk(sdp, &start);
715 for (; blks; gfs2_replay_incr_blk(sdp, &start), blks--) {
716 blkno = be64_to_cpu(*ptr++);
717 esc = be64_to_cpu(*ptr++);
718
719 sdp->sd_found_blocks++;
720
721 if (gfs2_revoke_check(sdp, blkno, start))
722 continue;
723
724 error = gfs2_replay_read_block(jd, start, &bh_log);
725 if (error)
726 return error;
727
728 bh_ip = gfs2_meta_new(gl, blkno);
729 memcpy(bh_ip->b_data, bh_log->b_data, bh_log->b_size);
730
731 /* Unescape */
732 if (esc) {
733 __be32 *eptr = (__be32 *)bh_ip->b_data;
734 *eptr = cpu_to_be32(GFS2_MAGIC);
735 }
736 mark_buffer_dirty(bh_ip);
737
738 brelse(bh_log);
739 brelse(bh_ip);
740 if (error)
741 break;
742
743 sdp->sd_replayed_blocks++;
744 }
745
746 return error;
747}
748
749/* FIXME: sort out accounting for log blocks etc. */
750
751static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
752{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400753 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
754 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000755
756 if (error) {
Steven Whitehouse7276b3b2006-09-21 17:05:23 -0400757 gfs2_meta_sync(ip->i_gl);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000758 return;
759 }
760 if (pass != 1)
761 return;
762
763 /* data sync? */
Steven Whitehouse7276b3b2006-09-21 17:05:23 -0400764 gfs2_meta_sync(ip->i_gl);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000765
766 fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n",
767 jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks);
768}
769
770static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
771{
772 struct list_head *head = &sdp->sd_log_le_databuf;
773 struct gfs2_bufdata *bd;
774
775 while (!list_empty(head)) {
776 bd = list_entry(head->next, struct gfs2_bufdata, bd_le.le_list);
Steven Whitehouseb8e1aab2006-08-22 16:25:50 -0400777 list_del_init(&bd->bd_le.le_list);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000778 sdp->sd_log_num_databuf--;
779 sdp->sd_log_num_jdata--;
780 gfs2_unpin(sdp, bd->bd_bh, ai);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000781 }
782 gfs2_assert_warn(sdp, !sdp->sd_log_num_databuf);
783 gfs2_assert_warn(sdp, !sdp->sd_log_num_jdata);
784}
785
786
Steven Whitehouseb09e5932006-04-07 11:17:32 -0400787const struct gfs2_log_operations gfs2_glock_lops = {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000788 .lo_add = glock_lo_add,
789 .lo_after_commit = glock_lo_after_commit,
Steven Whitehouseea67eed2006-09-05 10:53:09 -0400790 .lo_name = "glock",
David Teiglandb3b94fa2006-01-16 16:50:04 +0000791};
792
Steven Whitehouseb09e5932006-04-07 11:17:32 -0400793const struct gfs2_log_operations gfs2_buf_lops = {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000794 .lo_add = buf_lo_add,
795 .lo_incore_commit = buf_lo_incore_commit,
796 .lo_before_commit = buf_lo_before_commit,
797 .lo_after_commit = buf_lo_after_commit,
798 .lo_before_scan = buf_lo_before_scan,
799 .lo_scan_elements = buf_lo_scan_elements,
800 .lo_after_scan = buf_lo_after_scan,
Steven Whitehouseea67eed2006-09-05 10:53:09 -0400801 .lo_name = "buf",
David Teiglandb3b94fa2006-01-16 16:50:04 +0000802};
803
Steven Whitehouseb09e5932006-04-07 11:17:32 -0400804const struct gfs2_log_operations gfs2_revoke_lops = {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000805 .lo_add = revoke_lo_add,
806 .lo_before_commit = revoke_lo_before_commit,
807 .lo_before_scan = revoke_lo_before_scan,
808 .lo_scan_elements = revoke_lo_scan_elements,
809 .lo_after_scan = revoke_lo_after_scan,
Steven Whitehouseea67eed2006-09-05 10:53:09 -0400810 .lo_name = "revoke",
David Teiglandb3b94fa2006-01-16 16:50:04 +0000811};
812
Steven Whitehouseb09e5932006-04-07 11:17:32 -0400813const struct gfs2_log_operations gfs2_rg_lops = {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000814 .lo_add = rg_lo_add,
815 .lo_after_commit = rg_lo_after_commit,
Steven Whitehouseea67eed2006-09-05 10:53:09 -0400816 .lo_name = "rg",
David Teiglandb3b94fa2006-01-16 16:50:04 +0000817};
818
Steven Whitehouseb09e5932006-04-07 11:17:32 -0400819const struct gfs2_log_operations gfs2_databuf_lops = {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000820 .lo_add = databuf_lo_add,
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000821 .lo_incore_commit = buf_lo_incore_commit,
David Teiglandb3b94fa2006-01-16 16:50:04 +0000822 .lo_before_commit = databuf_lo_before_commit,
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000823 .lo_after_commit = databuf_lo_after_commit,
824 .lo_scan_elements = databuf_lo_scan_elements,
825 .lo_after_scan = databuf_lo_after_scan,
Steven Whitehouseea67eed2006-09-05 10:53:09 -0400826 .lo_name = "databuf",
David Teiglandb3b94fa2006-01-16 16:50:04 +0000827};
828
Steven Whitehouseb09e5932006-04-07 11:17:32 -0400829const struct gfs2_log_operations *gfs2_log_ops[] = {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000830 &gfs2_glock_lops,
831 &gfs2_buf_lops,
832 &gfs2_revoke_lops,
833 &gfs2_rg_lops,
834 &gfs2_databuf_lops,
Steven Whitehouseea67eed2006-09-05 10:53:09 -0400835 NULL,
David Teiglandb3b94fa2006-01-16 16:50:04 +0000836};
837