Lines Matching +full:i +full:- +full:leak +full:- +full:current
1 // SPDX-License-Identifier: GPL-2.0-or-later
27 * Bits on bh->b_state used by ocfs2.
43 trace_ocfs2_write_block((unsigned long long)bh->b_blocknr, ci); in ocfs2_write_block()
45 BUG_ON(bh->b_blocknr < OCFS2_SUPER_BLOCK_BLKNO); in ocfs2_write_block()
50 * can get modified during recovery even if read-only. */ in ocfs2_write_block()
52 ret = -EROFS; in ocfs2_write_block()
62 /* remove from dirty list before I/O. */ in ocfs2_write_block()
66 bh->b_end_io = end_buffer_write_sync; in ocfs2_write_block()
77 ret = -EIO; in ocfs2_write_block()
86 /* Caller must provide a bhs[] with all NULL or non-NULL entries, so it
93 unsigned int i; in ocfs2_read_blocks_sync() local
102 /* Don't put buffer head and re-assign it to NULL if it is allocated in ocfs2_read_blocks_sync()
107 for (i = 0 ; i < nr ; i++) { in ocfs2_read_blocks_sync()
108 if (bhs[i] == NULL) { in ocfs2_read_blocks_sync()
109 bhs[i] = sb_getblk(osb->sb, block++); in ocfs2_read_blocks_sync()
110 if (bhs[i] == NULL) { in ocfs2_read_blocks_sync()
111 status = -ENOMEM; in ocfs2_read_blocks_sync()
116 bh = bhs[i]; in ocfs2_read_blocks_sync()
120 (unsigned long long)bh->b_blocknr); in ocfs2_read_blocks_sync()
130 (unsigned long long)bh->b_blocknr); in ocfs2_read_blocks_sync()
139 "while I was in lock_buffer!", in ocfs2_read_blocks_sync()
140 (unsigned long long)bh->b_blocknr); in ocfs2_read_blocks_sync()
149 bh->b_end_io = end_buffer_read_sync; in ocfs2_read_blocks_sync()
154 for (i = nr; i > 0; i--) { in ocfs2_read_blocks_sync()
155 bh = bhs[i - 1]; in ocfs2_read_blocks_sync()
161 * avoid bh leak in ocfs2_read_blocks_sync()
166 bhs[i - 1] = NULL; in ocfs2_read_blocks_sync()
181 status = -EIO; in ocfs2_read_blocks_sync()
190 /* Caller must provide a bhs[] with all NULL or non-NULL entries, so it
199 int i, ignore_cache = 0; in ocfs2_read_blocks() local
211 status = -EINVAL; in ocfs2_read_blocks()
218 status = -EINVAL; in ocfs2_read_blocks()
228 /* Don't put buffer head and re-assign it to NULL if it is allocated in ocfs2_read_blocks()
234 for (i = 0 ; i < nr ; i++) { in ocfs2_read_blocks()
235 if (bhs[i] == NULL) { in ocfs2_read_blocks()
236 bhs[i] = sb_getblk(sb, block++); in ocfs2_read_blocks()
237 if (bhs[i] == NULL) { in ocfs2_read_blocks()
238 status = -ENOMEM; in ocfs2_read_blocks()
244 bh = bhs[i]; in ocfs2_read_blocks()
247 /* There are three read-ahead cases here which we need to in ocfs2_read_blocks()
250 * and it hasn't yet completed I/O. in ocfs2_read_blocks()
252 * 1) The current request is sync to disk. This rarely in ocfs2_read_blocks()
254 * matters - the code can just wait on the buffer in ocfs2_read_blocks()
255 * lock and re-submit. in ocfs2_read_blocks()
257 * 2) The current request is cached, but not in ocfs2_read_blocks()
260 * buffer lock to do I/O. We re-check the request in ocfs2_read_blocks()
261 * with after getting the lock to avoid a re-submit. in ocfs2_read_blocks()
263 * 3) The current request is readahead (and so must in ocfs2_read_blocks()
265 * buffer is locked (under I/O) and if it's in the in ocfs2_read_blocks()
266 * uptodate cache. The re-check from #2 catches the in ocfs2_read_blocks()
267 * case that the previous read-ahead completes just in ocfs2_read_blocks()
268 * before our is-it-in-flight check. in ocfs2_read_blocks()
273 (unsigned long long)bh->b_blocknr, in ocfs2_read_blocks()
280 trace_ocfs2_read_blocks_bh((unsigned long long)bh->b_blocknr, in ocfs2_read_blocks()
294 /* A read-ahead request was made - if the in ocfs2_read_blocks()
295 * buffer is already under read-ahead from a in ocfs2_read_blocks()
306 "while I was in lock_buffer!", in ocfs2_read_blocks()
307 (unsigned long long)bh->b_blocknr); in ocfs2_read_blocks()
315 /* Re-check ocfs2_buffer_uptodate() as a in ocfs2_read_blocks()
316 * previously read-ahead buffer may have in ocfs2_read_blocks()
317 * completed I/O while we were waiting for the in ocfs2_read_blocks()
329 bh->b_end_io = end_buffer_read_sync; in ocfs2_read_blocks()
336 for (i = (nr - 1); i >= 0; i--) { in ocfs2_read_blocks()
337 bh = bhs[i]; in ocfs2_read_blocks()
347 * avoid bh leak in ocfs2_read_blocks()
352 bhs[i] = NULL; in ocfs2_read_blocks()
371 status = -EIO; in ocfs2_read_blocks()
389 * a forced read, or read-ahead which hasn't yet in ocfs2_read_blocks()
408 int i; in ocfs2_check_super_or_backup() local
414 for (i = 0; i < OCFS2_MAX_BACKUP_SUPERBLOCKS; i++) { in ocfs2_check_super_or_backup()
415 backup_blkno = ocfs2_backup_super_blkno(sb, i); in ocfs2_check_super_or_backup()
432 struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; in ocfs2_write_super_or_backup()
435 ocfs2_check_super_or_backup(osb->sb, bh->b_blocknr); in ocfs2_write_super_or_backup()
438 ret = -EROFS; in ocfs2_write_super_or_backup()
446 /* remove from dirty list before I/O. */ in ocfs2_write_super_or_backup()
450 bh->b_end_io = end_buffer_write_sync; in ocfs2_write_super_or_backup()
451 ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &di->i_check); in ocfs2_write_super_or_backup()
457 ret = -EIO; in ocfs2_write_super_or_backup()