Lines Matching refs:bh
70 struct buffer_head *bh;
71 int bufsize = sizeof(*bh) + kdev->k_ctx->fs->blocksize -
72 sizeof(bh->b_data);
74 bh = e2fsck_allocate_memory(kdev->k_ctx, bufsize, "block buffer");
75 if (!bh)
85 bh->b_ctx = kdev->k_ctx;
87 bh->b_io = kdev->k_ctx->fs->io;
89 bh->b_io = kdev->k_ctx->journal_io;
90 bh->b_size = blocksize;
91 bh->b_blocknr = blocknr;
93 return bh;
111 struct buffer_head *bh;
114 bh = *bhp++;
115 if (rw == READ && !bh->b_uptodate) {
117 (unsigned long) bh->b_blocknr, (void *) bh);
118 retval = io_channel_read_blk(bh->b_io,
119 bh->b_blocknr,
120 1, bh->b_data);
122 com_err(bh->b_ctx->device_name, retval,
124 (unsigned long) bh->b_blocknr);
125 bh->b_err = retval;
128 bh->b_uptodate = 1;
129 } else if (rw == WRITE && bh->b_dirty) {
131 (unsigned long) bh->b_blocknr, (void *) bh);
132 retval = io_channel_write_blk(bh->b_io,
133 bh->b_blocknr,
134 1, bh->b_data);
136 com_err(bh->b_ctx->device_name, retval,
138 (unsigned long) bh->b_blocknr);
139 bh->b_err = retval;
142 bh->b_dirty = 0;
143 bh->b_uptodate = 1;
147 (unsigned long) bh->b_blocknr);
152 void mark_buffer_dirty(struct buffer_head *bh)
154 bh->b_dirty = 1;
157 static void mark_buffer_clean(struct buffer_head * bh)
159 bh->b_dirty = 0;
162 void brelse(struct buffer_head *bh)
164 if (bh->b_dirty)
165 ll_rw_block(WRITE, 1, &bh);
167 (unsigned long) bh->b_blocknr, (void *) bh, --bh_count);
168 ext2fs_free_mem(&bh);
171 int buffer_uptodate(struct buffer_head *bh)
173 return bh->b_uptodate;
176 void mark_buffer_uptodate(struct buffer_head *bh, int val)
178 bh->b_uptodate = val;
181 void wait_on_buffer(struct buffer_head *bh)
183 if (!bh->b_uptodate)
184 ll_rw_block(READ, 1, &bh);
232 struct buffer_head *bh;
381 bh = getblk(dev_journal, start, ctx->fs->blocksize);
382 if (!bh) {
386 ll_rw_block(READ, 1, &bh);
387 if ((retval = bh->b_err) != 0) {
388 brelse(bh);
391 memcpy(&jsuper, start ? bh->b_data : bh->b_data + 1024,
393 brelse(bh);
416 if (!(bh = getblk(dev_journal, start, journal->j_blocksize))) {
421 journal->j_sb_buffer = bh;
422 journal->j_superblock = (journal_superblock_t *)bh->b_data;