journal.h (cf1d6c763fbcb115263114302485ad17e7933d87) journal.h (2b4e30fbde425828b17f0e9c8f8e3fd3ecb2bc75)
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * journal.h
5 *
6 * Defines journalling api and structures.
7 *
8 * Copyright (C) 2003, 2005 Oracle. All rights reserved.

--- 13 unchanged lines hidden (view full) ---

22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 021110-1307, USA.
24 */
25
26#ifndef OCFS2_JOURNAL_H
27#define OCFS2_JOURNAL_H
28
29#include <linux/fs.h>
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * journal.h
5 *
6 * Defines journalling api and structures.
7 *
8 * Copyright (C) 2003, 2005 Oracle. All rights reserved.

--- 13 unchanged lines hidden (view full) ---

22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 021110-1307, USA.
24 */
25
26#ifndef OCFS2_JOURNAL_H
27#define OCFS2_JOURNAL_H
28
29#include <linux/fs.h>
30#include <linux/jbd.h>
30#ifndef CONFIG_OCFS2_COMPAT_JBD
31# include <linux/jbd2.h>
32#else
33# include <linux/jbd.h>
34# include "ocfs2_jbd_compat.h"
35#endif
31
32enum ocfs2_journal_state {
33 OCFS2_JOURNAL_FREE = 0,
34 OCFS2_JOURNAL_LOADED,
35 OCFS2_JOURNAL_IN_SHUTDOWN,
36};
37
38struct ocfs2_super;

--- 171 unchanged lines hidden (view full) ---

210 * later transaction).
211 * ocfs2_extend_trans - Extend a handle by nblocks credits. This may
212 * commit the handle to disk in the process, but will
213 * not release any locks taken during the transaction.
214 * ocfs2_journal_access - Notify the handle that we want to journal this
215 * buffer. Will have to call ocfs2_journal_dirty once
216 * we've actually dirtied it. Type is one of . or .
217 * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data.
36
37enum ocfs2_journal_state {
38 OCFS2_JOURNAL_FREE = 0,
39 OCFS2_JOURNAL_LOADED,
40 OCFS2_JOURNAL_IN_SHUTDOWN,
41};
42
43struct ocfs2_super;

--- 171 unchanged lines hidden (view full) ---

215 * later transaction).
216 * ocfs2_extend_trans - Extend a handle by nblocks credits. This may
217 * commit the handle to disk in the process, but will
218 * not release any locks taken during the transaction.
219 * ocfs2_journal_access - Notify the handle that we want to journal this
220 * buffer. Will have to call ocfs2_journal_dirty once
221 * we've actually dirtied it. Type is one of . or .
222 * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data.
218 * ocfs2_journal_dirty_data - Indicate that a data buffer should go out before
219 * the current handle commits.
223 * ocfs2_jbd2_file_inode - Mark an inode so that its data goes out before
224 * the current handle commits.
220 */
221
222/* You must always start_trans with a number of buffs > 0, but it's
223 * perfectly legal to go through an entire transaction without having
224 * dirtied any buffers. */
225handle_t *ocfs2_start_trans(struct ocfs2_super *osb,
226 int max_buffs);
227int ocfs2_commit_trans(struct ocfs2_super *osb,

--- 35 unchanged lines hidden (view full) ---

263 *
264 * <read a bh>
265 * ocfs2_journal_access(handle, bh, OCFS2_JOURNAL_ACCESS_WRITE);
266 * <modify the bh>
267 * ocfs2_journal_dirty(handle, bh);
268 */
269int ocfs2_journal_dirty(handle_t *handle,
270 struct buffer_head *bh);
225 */
226
227/* You must always start_trans with a number of buffs > 0, but it's
228 * perfectly legal to go through an entire transaction without having
229 * dirtied any buffers. */
230handle_t *ocfs2_start_trans(struct ocfs2_super *osb,
231 int max_buffs);
232int ocfs2_commit_trans(struct ocfs2_super *osb,

--- 35 unchanged lines hidden (view full) ---

268 *
269 * <read a bh>
270 * ocfs2_journal_access(handle, bh, OCFS2_JOURNAL_ACCESS_WRITE);
271 * <modify the bh>
272 * ocfs2_journal_dirty(handle, bh);
273 */
274int ocfs2_journal_dirty(handle_t *handle,
275 struct buffer_head *bh);
276#ifdef CONFIG_OCFS2_COMPAT_JBD
271int ocfs2_journal_dirty_data(handle_t *handle,
272 struct buffer_head *bh);
277int ocfs2_journal_dirty_data(handle_t *handle,
278 struct buffer_head *bh);
279#endif
273
274/*
275 * Credit Macros:
276 * Convenience macros to calculate number of credits needed.
277 *
278 * For convenience sake, I have a set of macros here which calculate
279 * the *maximum* number of sectors which will be changed for various
280 * metadata updates.

--- 144 unchanged lines hidden (view full) ---

425 credits += 1 + tree_depth;
426
427 /* update to the truncate log. */
428 credits += OCFS2_TRUNCATE_LOG_UPDATE;
429
430 return credits;
431}
432
280
281/*
282 * Credit Macros:
283 * Convenience macros to calculate number of credits needed.
284 *
285 * For convenience sake, I have a set of macros here which calculate
286 * the *maximum* number of sectors which will be changed for various
287 * metadata updates.

--- 144 unchanged lines hidden (view full) ---

432 credits += 1 + tree_depth;
433
434 /* update to the truncate log. */
435 credits += OCFS2_TRUNCATE_LOG_UPDATE;
436
437 return credits;
438}
439
440static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode)
441{
442 return jbd2_journal_file_inode(handle, &OCFS2_I(inode)->ip_jinode);
443}
444
445static inline int ocfs2_begin_ordered_truncate(struct inode *inode,
446 loff_t new_size)
447{
448 return jbd2_journal_begin_ordered_truncate(&OCFS2_I(inode)->ip_jinode,
449 new_size);
450}
451
433#endif /* OCFS2_JOURNAL_H */
452#endif /* OCFS2_JOURNAL_H */