27 #include <linux/types.h>
58 trace_ocfs2_write_block((
unsigned long long)bh->b_blocknr, ci);
66 if (ocfs2_is_hard_readonly(osb)) {
75 set_buffer_uptodate(bh);
78 clear_buffer_dirty(bh);
86 if (buffer_uptodate(bh)) {
103 unsigned int nr,
struct buffer_head *bhs[])
107 struct buffer_head *bh;
109 trace_ocfs2_read_blocks_sync((
unsigned long long)block, nr);
114 for (i = 0 ; i <
nr ; i++) {
115 if (bhs[i] ==
NULL) {
116 bhs[
i] = sb_getblk(osb->
sb, block++);
117 if (bhs[i] ==
NULL) {
125 if (buffer_jbd(bh)) {
126 trace_ocfs2_read_blocks_sync_jbd(
127 (
unsigned long long)bh->b_blocknr);
131 if (buffer_dirty(bh)) {
135 "trying to sync read a dirty "
136 "buffer! (blocknr = %llu), skipping\n",
137 (
unsigned long long)bh->b_blocknr);
142 if (buffer_jbd(bh)) {
144 "block %llu had the JBD bit set "
145 "while I was in lock_buffer!",
146 (
unsigned long long)bh->b_blocknr);
150 clear_buffer_uptodate(bh);
156 for (i = nr; i > 0; i--) {
163 if (!buffer_uptodate(bh)) {
178 struct buffer_head *bhs[],
int flags,
180 struct buffer_head *bh))
183 int i, ignore_cache = 0;
184 struct buffer_head *bh;
187 trace_ocfs2_read_blocks_begin(ci, (
unsigned long long)block, nr, flags);
212 for (i = 0 ; i <
nr ; i++) {
213 if (bhs[i] ==
NULL) {
214 bhs[
i] = sb_getblk(sb, block++);
215 if (bhs[i] ==
NULL) {
250 trace_ocfs2_read_blocks_from_disk(
251 (
unsigned long long)bh->b_blocknr,
258 trace_ocfs2_read_blocks_bh((
unsigned long long)bh->b_blocknr,
259 ignore_cache, buffer_jbd(bh), buffer_dirty(bh));
261 if (buffer_jbd(bh)) {
266 if (buffer_dirty(bh)) {
276 if ((flags & OCFS2_BH_READAHEAD)
281 if (buffer_jbd(bh)) {
282 #ifdef CATCH_BH_JBD_RACES
284 "while I was in lock_buffer!",
285 (
unsigned long long)bh->b_blocknr);
297 if (!(flags & OCFS2_BH_IGNORE_CACHE)
298 && !(flags & OCFS2_BH_READAHEAD)
304 clear_buffer_uptodate(bh);
307 set_buffer_needs_validate(bh);
316 for (i = (nr - 1); i >= 0; i--) {
319 if (!(flags & OCFS2_BH_READAHEAD)) {
326 if (!buffer_uptodate(bh)) {
339 if (buffer_needs_validate(bh)) {
344 clear_buffer_needs_validate(bh);
361 trace_ocfs2_read_blocks_end((
unsigned long long)block, nr,
362 flags, ignore_cache);
370 static void ocfs2_check_super_or_backup(
struct super_block *
sb,
380 backup_blkno = ocfs2_backup_super_blkno(sb, i);
381 if (backup_blkno == blkno)
394 struct buffer_head *bh)
400 ocfs2_check_super_or_backup(osb->
sb, bh->b_blocknr);
402 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) {
409 set_buffer_uptodate(bh);
412 clear_buffer_dirty(bh);
421 if (!buffer_uptodate(bh)) {