goto got_dent;
leaf = (struct gfs2_leaf *)bh->b_data;
ln = be64_to_cpu(leaf->lf_next);
+ brelse(bh);
if (!ln)
break;
- brelse(bh);
error = get_leaf(ip, ln, &bh);
} while(!error);
return ERR_PTR(error);
dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL);
got_dent:
- if (unlikely(IS_ERR(dent))) {
+ if (unlikely(dent == NULL || IS_ERR(dent))) {
brelse(bh);
bh = NULL;
}
brelse(bh);
return 0;
}
- brelse(bh);
return -ENOENT;
}
previous entry otherwise */
dent = gfs2_dirent_search(dip->i_vnode, name, gfs2_dirent_prev, &bh);
if (!dent) {
- brelse(bh);
gfs2_consist_inode(dip);
return -EIO;
}
dent = gfs2_dirent_search(dip->i_vnode, filename, gfs2_dirent_find, &bh);
if (!dent) {
- brelse(bh);
gfs2_consist_inode(dip);
return -EIO;
}
dent = gfs2_dirent_search(inode, name, gfs2_dirent_find_space, &bh);
if (!dent) {
- brelse(bh);
return 1;
}
if (IS_ERR(dent))
struct list_head *head = &sdp->sd_log_flush_list;
struct gfs2_log_buf *lb;
struct buffer_head *bh;
+#if 0
unsigned int d;
d = log_distance(sdp, sdp->sd_log_flush_head, sdp->sd_log_head);
gfs2_assert_withdraw(sdp, d + 1 == sdp->sd_log_blks_reserved);
+#endif
while (!list_empty(head)) {
lb = list_entry(head->next, struct gfs2_log_buf, lb_list);
sdp->sd_log_head = sdp->sd_log_flush_head;
/* printk(KERN_INFO "sd_log_num_hdrs %u\n", sdp->sd_log_num_hdrs); */
+ sdp->sd_log_blks_free -= sdp->sd_log_num_hdrs;
sdp->sd_log_blks_reserved =
sdp->sd_log_commited_buf =
gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_revoke) >= 0);
if (sdp->sd_log_commited_buf)
- reserved += 1 + sdp->sd_log_commited_buf +
- sdp->sd_log_commited_buf/503;
+ reserved += sdp->sd_log_commited_buf;
if (sdp->sd_log_commited_revoke)
reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke,
sizeof(uint64_t));
gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free >= old);
gfs2_assert_withdraw(sdp,
- sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
+ sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks +
+ sdp->sd_log_num_hdrs);
sdp->sd_log_blks_reserved = reserved;
log_write_header(sdp, GFS2_LOG_HEAD_UNMOUNT, 0);
+ /* printk(KERN_INFO "sd_log_blks_free %u, sd_jdesc->jd_blocks %u\n", sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); */
gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free ==
sdp->sd_jdesc->jd_blocks);
gfs2_assert_withdraw(sdp, sdp->sd_log_head == sdp->sd_log_tail);
tr->tr_revokes = revokes;
tr->tr_reserved = 1;
if (blocks)
- tr->tr_reserved += 1 + blocks;
+ tr->tr_reserved += 6 + blocks;
if (revokes)
tr->tr_reserved += gfs2_struct2blk(sdp, revokes,
sizeof(uint64_t));
void gfs2_trans_end(struct gfs2_sbd *sdp)
{
- struct gfs2_trans *tr;
+ struct gfs2_trans *tr = current->journal_info;
- tr = current->journal_info;
+ BUG_ON(!tr);
current->journal_info = NULL;
- if (gfs2_assert_warn(sdp, tr))
- return;
-
if (!tr->tr_touched) {
gfs2_log_release(sdp, tr->tr_reserved);
-
gfs2_glock_dq(&tr->tr_t_gh);
gfs2_holder_uninit(&tr->tr_t_gh);
-
kfree(tr);
return;
}
}
gfs2_log_commit(sdp, tr);
-
gfs2_glock_dq(&tr->tr_t_gh);
gfs2_holder_uninit(&tr->tr_t_gh);
-
kfree(tr);
if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS)