PM / yenta: Split resume into early and late parts (rev. 4)
[linux/fpc-iii.git] / fs / ext4 / ext4_jbd2.c
blobeb27fd0f2ee86dd4c8badd2ed146f2a306e1f35f
1 /*
2 * Interface between ext4 and JBD
3 */
5 #include "ext4_jbd2.h"
7 int __ext4_journal_get_undo_access(const char *where, handle_t *handle,
8 struct buffer_head *bh)
10 int err = 0;
12 if (ext4_handle_valid(handle)) {
13 err = jbd2_journal_get_undo_access(handle, bh);
14 if (err)
15 ext4_journal_abort_handle(where, __func__, bh,
16 handle, err);
18 return err;
21 int __ext4_journal_get_write_access(const char *where, handle_t *handle,
22 struct buffer_head *bh)
24 int err = 0;
26 if (ext4_handle_valid(handle)) {
27 err = jbd2_journal_get_write_access(handle, bh);
28 if (err)
29 ext4_journal_abort_handle(where, __func__, bh,
30 handle, err);
32 return err;
35 int __ext4_journal_forget(const char *where, handle_t *handle,
36 struct buffer_head *bh)
38 int err = 0;
40 if (ext4_handle_valid(handle)) {
41 err = jbd2_journal_forget(handle, bh);
42 if (err)
43 ext4_journal_abort_handle(where, __func__, bh,
44 handle, err);
46 else
47 brelse(bh);
48 return err;
51 int __ext4_journal_revoke(const char *where, handle_t *handle,
52 ext4_fsblk_t blocknr, struct buffer_head *bh)
54 int err = 0;
56 if (ext4_handle_valid(handle)) {
57 err = jbd2_journal_revoke(handle, blocknr, bh);
58 if (err)
59 ext4_journal_abort_handle(where, __func__, bh,
60 handle, err);
62 else
63 brelse(bh);
64 return err;
67 int __ext4_journal_get_create_access(const char *where,
68 handle_t *handle, struct buffer_head *bh)
70 int err = 0;
72 if (ext4_handle_valid(handle)) {
73 err = jbd2_journal_get_create_access(handle, bh);
74 if (err)
75 ext4_journal_abort_handle(where, __func__, bh,
76 handle, err);
78 return err;
81 int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
82 struct inode *inode, struct buffer_head *bh)
84 int err = 0;
86 if (ext4_handle_valid(handle)) {
87 err = jbd2_journal_dirty_metadata(handle, bh);
88 if (err)
89 ext4_journal_abort_handle(where, __func__, bh,
90 handle, err);
91 } else {
92 mark_buffer_dirty(bh);
93 if (inode && inode_needs_sync(inode)) {
94 sync_dirty_buffer(bh);
95 if (buffer_req(bh) && !buffer_uptodate(bh)) {
96 ext4_error(inode->i_sb, __func__,
97 "IO error syncing inode, "
98 "inode=%lu, block=%llu",
99 inode->i_ino,
100 (unsigned long long) bh->b_blocknr);
101 err = -EIO;
105 return err;