Lines Matching +full:ip +full:- +full:block
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
4 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
49 * If it's a fully non-blocking write attempt and we cannot in gfs2_aspace_writepage()
51 * potentially cause a busy-wait loop from flusher thread and kswapd in gfs2_aspace_writepage()
52 * activity, but those code paths have their own higher-level in gfs2_aspace_writepage()
55 if (wbc->sync_mode != WB_SYNC_NONE) { in gfs2_aspace_writepage()
66 } while ((bh = bh->b_this_page) != head); in gfs2_aspace_writepage()
76 struct buffer_head *next = bh->b_this_page; in gfs2_aspace_writepage()
102 * gfs2_getbuf - Get a buffer with a given address space
104 * @blkno: the block number (filesystem scope)
113 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in gfs2_getbuf()
121 mapping = &sdp->sd_aspace; in gfs2_getbuf()
123 shift = PAGE_SHIFT - sdp->sd_sb.sb_bsize_shift; in gfs2_getbuf()
124 index = blkno >> shift; /* convert block to page */ in gfs2_getbuf()
125 bufnum = blkno - (index << shift); /* block buf index within page */ in gfs2_getbuf()
142 create_empty_buffers(page, sdp->sd_sb.sb_bsize, 0); in gfs2_getbuf()
145 for (bh = page_buffers(page); bufnum--; bh = bh->b_this_page) in gfs2_getbuf()
150 map_bh(bh, sdp->sd_vfs, blkno); in gfs2_getbuf()
160 struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data; in meta_prep_new()
167 mh->mh_magic = cpu_to_be32(GFS2_MAGIC); in meta_prep_new()
171 * gfs2_meta_new - Get a block
172 * @gl: The glock associated with this block
173 * @blkno: The block number
192 struct page *page = bvec->bv_page; in gfs2_meta_read_endio()
194 unsigned int len = bvec->bv_len; in gfs2_meta_read_endio()
196 while (bh_offset(bh) < bvec->bv_offset) in gfs2_meta_read_endio()
197 bh = bh->b_this_page; in gfs2_meta_read_endio()
199 struct buffer_head *next = bh->b_this_page; in gfs2_meta_read_endio()
200 len -= bh->b_size; in gfs2_meta_read_endio()
201 bh->b_end_io(bh, !bio->bi_status); in gfs2_meta_read_endio()
220 bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); in gfs2_submit_bhs()
221 bio_set_dev(bio, bh->b_bdev); in gfs2_submit_bhs()
224 if (!bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh))) { in gfs2_submit_bhs()
225 BUG_ON(bio->bi_iter.bi_size == 0); in gfs2_submit_bhs()
229 num--; in gfs2_submit_bhs()
231 bio->bi_end_io = gfs2_meta_read_endio; in gfs2_submit_bhs()
238 * gfs2_meta_read - Read a block from disk
239 * @gl: The glock covering the block
240 * @blkno: The block number
250 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in gfs2_meta_read()
255 (!sdp->sd_jdesc || gl != sdp->sd_jinode_gl)) { in gfs2_meta_read()
257 return -EIO; in gfs2_meta_read()
267 bh->b_end_io = end_buffer_read_sync; in gfs2_meta_read()
280 bh->b_end_io = end_buffer_read_sync; in gfs2_meta_read()
292 struct gfs2_trans *tr = current->journal_info; in gfs2_meta_read()
293 if (tr && test_bit(TR_TOUCHED, &tr->tr_flags)) in gfs2_meta_read()
297 return -EIO; in gfs2_meta_read()
304 * gfs2_meta_wait - Reread a block from disk
306 * @bh: The block to wait for
314 return -EIO; in gfs2_meta_wait()
319 struct gfs2_trans *tr = current->journal_info; in gfs2_meta_wait()
320 if (tr && test_bit(TR_TOUCHED, &tr->tr_flags)) in gfs2_meta_wait()
322 return -EIO; in gfs2_meta_wait()
325 return -EIO; in gfs2_meta_wait()
332 struct address_space *mapping = bh->b_page->mapping; in gfs2_remove_from_journal()
334 struct gfs2_bufdata *bd = bh->b_private; in gfs2_remove_from_journal()
335 struct gfs2_trans *tr = current->journal_info; in gfs2_remove_from_journal()
340 atomic_dec(&sdp->sd_log_pinned); in gfs2_remove_from_journal()
341 list_del_init(&bd->bd_list); in gfs2_remove_from_journal()
343 tr->tr_num_buf_rm++; in gfs2_remove_from_journal()
345 tr->tr_num_databuf_rm++; in gfs2_remove_from_journal()
346 set_bit(TR_TOUCHED, &tr->tr_flags); in gfs2_remove_from_journal()
351 if (bd->bd_tr) { in gfs2_remove_from_journal()
354 bh->b_private = NULL; in gfs2_remove_from_journal()
356 } else if (!list_empty(&bd->bd_ail_st_list) && in gfs2_remove_from_journal()
357 !list_empty(&bd->bd_ail_gl_list)) { in gfs2_remove_from_journal()
366 * gfs2_ail1_wipe - remove deleted/freed buffers from the ail1 list
368 * @bstart: starting block address of buffers to remove
384 spin_lock(&sdp->sd_ail_lock); in gfs2_ail1_wipe()
385 list_for_each_entry_safe(tr, s, &sdp->sd_ail1_list, tr_list) { in gfs2_ail1_wipe()
386 list_for_each_entry_safe(bd, bs, &tr->tr_ail1_list, in gfs2_ail1_wipe()
388 bh = bd->bd_bh; in gfs2_ail1_wipe()
389 if (bh->b_blocknr < bstart || bh->b_blocknr >= end) in gfs2_ail1_wipe()
395 spin_unlock(&sdp->sd_ail_lock); in gfs2_ail1_wipe()
399 static struct buffer_head *gfs2_getjdatabuf(struct gfs2_inode *ip, u64 blkno) in gfs2_getjdatabuf() argument
401 struct address_space *mapping = ip->i_inode.i_mapping; in gfs2_getjdatabuf()
402 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); in gfs2_getjdatabuf()
405 unsigned int shift = PAGE_SHIFT - sdp->sd_sb.sb_bsize_shift; in gfs2_getjdatabuf()
406 unsigned long index = blkno >> shift; /* convert block to page */ in gfs2_getjdatabuf()
407 unsigned int bufnum = blkno - (index << shift); in gfs2_getjdatabuf()
418 for (bh = page_buffers(page); bufnum--; bh = bh->b_this_page) in gfs2_getjdatabuf()
427 * gfs2_journal_wipe - make inode's buffers so they aren't dirty/pinned anymore
428 * @ip: the inode who owns the buffers
434 void gfs2_journal_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen) in gfs2_journal_wipe() argument
436 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); in gfs2_journal_wipe()
443 bh = gfs2_getbuf(ip->i_gl, bstart, NO_CREATE); in gfs2_journal_wipe()
444 if (!bh && gfs2_is_jdata(ip)) { in gfs2_journal_wipe()
445 bh = gfs2_getjdatabuf(ip, bstart); in gfs2_journal_wipe()
451 spin_lock(&sdp->sd_ail_lock); in gfs2_journal_wipe()
453 spin_unlock(&sdp->sd_ail_lock); in gfs2_journal_wipe()
460 blen--; in gfs2_journal_wipe()
465 * gfs2_meta_indirect_buffer - Get a metadata buffer
466 * @ip: The GFS2 inode
468 * @num: The block number (device relative) of the buffer
474 int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num, in gfs2_meta_indirect_buffer() argument
477 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); in gfs2_meta_indirect_buffer()
478 struct gfs2_glock *gl = ip->i_gl; in gfs2_meta_indirect_buffer()
484 if (num == ip->i_no_addr) in gfs2_meta_indirect_buffer()
485 rahead = ip->i_rahead; in gfs2_meta_indirect_buffer()
490 ret = -EIO; in gfs2_meta_indirect_buffer()
498 * gfs2_meta_ra - start readahead on an extent of a file
500 * @dblock: the starting disk block
508 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in gfs2_meta_ra()
511 sdp->sd_sb.sb_bsize_shift; in gfs2_meta_ra()
528 extlen--; in gfs2_meta_ra()
539 extlen--; in gfs2_meta_ra()