Lines Matching refs:handle
58 int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, in ext3_forget() argument
82 return ext3_journal_forget(handle, bh); in ext3_forget()
91 err = ext3_journal_revoke(handle, blocknr, bh); in ext3_forget()
154 static int try_to_extend_transaction(handle_t *handle, struct inode *inode) in try_to_extend_transaction() argument
156 if (handle->h_buffer_credits > EXT3_RESERVE_TRANS_BLOCKS) in try_to_extend_transaction()
158 if (!ext3_journal_extend(handle, blocks_for_truncate(inode))) in try_to_extend_transaction()
168 static int truncate_restart_transaction(handle_t *handle, struct inode *inode) in truncate_restart_transaction() argument
172 jbd_debug(2, "restarting handle %p\n", handle); in truncate_restart_transaction()
180 ret = ext3_journal_restart(handle, blocks_for_truncate(inode)); in truncate_restart_transaction()
192 handle_t *handle; in ext3_evict_inode() local
242 handle = start_transaction(inode); in ext3_evict_inode()
243 if (IS_ERR(handle)) { in ext3_evict_inode()
254 handle->h_sync = 1; in ext3_evict_inode()
264 ext3_orphan_del(handle, inode); in ext3_evict_inode()
274 if (ext3_mark_inode_dirty(handle, inode)) { in ext3_evict_inode()
279 ext3_xattr_delete_inode(handle, inode); in ext3_evict_inode()
283 ext3_free_inode(handle, inode); in ext3_evict_inode()
285 ext3_journal_stop(handle); in ext3_evict_inode()
575 static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, in ext3_alloc_blocks() argument
598 current_block = ext3_new_blocks(handle,inode,goal,&count,err); in ext3_alloc_blocks()
622 ext3_free_blocks(handle, inode, new_blocks[i], 1); in ext3_alloc_blocks()
653 static int ext3_alloc_branch(handle_t *handle, struct inode *inode, in ext3_alloc_branch() argument
665 num = ext3_alloc_blocks(handle, inode, goal, indirect_blks, in ext3_alloc_branch()
688 err = ext3_journal_get_create_access(handle, bh); in ext3_alloc_branch()
714 err = ext3_journal_dirty_metadata(handle, bh); in ext3_alloc_branch()
724 ext3_journal_forget(handle, branch[i].bh); in ext3_alloc_branch()
727 ext3_free_blocks(handle, inode, new_blocks[i], 1); in ext3_alloc_branch()
729 ext3_free_blocks(handle, inode, new_blocks[i], num); in ext3_alloc_branch()
747 static int ext3_splice_branch(handle_t *handle, struct inode *inode, in ext3_splice_branch() argument
765 err = ext3_journal_get_write_access(handle, where->bh); in ext3_splice_branch()
798 ext3_mark_inode_dirty(handle, inode); in ext3_splice_branch()
801 atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid); in ext3_splice_branch()
815 err = ext3_journal_dirty_metadata(handle, where->bh); in ext3_splice_branch()
830 ext3_journal_forget(handle, where[i].bh); in ext3_splice_branch()
831 ext3_free_blocks(handle,inode,le32_to_cpu(where[i-1].key),1); in ext3_splice_branch()
833 ext3_free_blocks(handle, inode, le32_to_cpu(where[num].key), blks); in ext3_splice_branch()
857 int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, in ext3_get_blocks_handle() argument
876 J_ASSERT(handle != NULL || create == 0); in ext3_get_blocks_handle()
971 err = ext3_alloc_branch(handle, inode, indirect_blks, &count, goal, in ext3_get_blocks_handle()
982 err = ext3_splice_branch(handle, inode, iblock, in ext3_get_blocks_handle()
1024 handle_t *handle = ext3_journal_current_handle(); in ext3_get_block() local
1028 if (create && !handle) { /* Direct IO write... */ in ext3_get_block()
1031 handle = ext3_journal_start(inode, DIO_CREDITS + in ext3_get_block()
1033 if (IS_ERR(handle)) { in ext3_get_block()
1034 ret = PTR_ERR(handle); in ext3_get_block()
1040 ret = ext3_get_blocks_handle(handle, inode, iblock, in ext3_get_block()
1047 ext3_journal_stop(handle); in ext3_get_block()
1062 struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode, in ext3_getblk() argument
1068 J_ASSERT(handle != NULL || create == 0); in ext3_getblk()
1073 err = ext3_get_blocks_handle(handle, inode, block, 1, in ext3_getblk()
1093 J_ASSERT(handle != NULL); in ext3_getblk()
1104 fatal = ext3_journal_get_create_access(handle, bh); in ext3_getblk()
1111 err = ext3_journal_dirty_metadata(handle, bh); in ext3_getblk()
1128 struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode, in ext3_bread() argument
1133 bh = ext3_getblk(handle, inode, block, create, err); in ext3_bread()
1149 static int walk_page_buffers( handle_t *handle, in walk_page_buffers() argument
1154 int (*fn)( handle_t *handle, in walk_page_buffers()
1174 err = (*fn)(handle, bh); in walk_page_buffers()
1206 static int do_journal_get_write_access(handle_t *handle, in do_journal_get_write_access() argument
1224 ret = ext3_journal_get_write_access(handle, bh); in do_journal_get_write_access()
1226 ret = ext3_journal_dirty_metadata(handle, bh); in do_journal_get_write_access()
1256 handle_t *handle; in ext3_write_begin() local
1277 handle = ext3_journal_start(inode, needed_blocks); in ext3_write_begin()
1278 if (IS_ERR(handle)) { in ext3_write_begin()
1281 ret = PTR_ERR(handle); in ext3_write_begin()
1289 ret = walk_page_buffers(handle, page_buffers(page), in ext3_write_begin()
1304 ext3_orphan_add(handle, inode); in ext3_write_begin()
1305 ext3_journal_stop(handle); in ext3_write_begin()
1318 int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh) in ext3_journal_dirty_data() argument
1320 int err = journal_dirty_data(handle, bh); in ext3_journal_dirty_data()
1323 bh, handle, err); in ext3_journal_dirty_data()
1328 static int journal_dirty_data_fn(handle_t *handle, struct buffer_head *bh) in journal_dirty_data_fn() argument
1335 return ext3_journal_dirty_data(handle, bh); in journal_dirty_data_fn()
1340 static int write_end_fn(handle_t *handle, struct buffer_head *bh) in write_end_fn() argument
1345 return ext3_journal_dirty_metadata(handle, bh); in write_end_fn()
1377 handle_t *handle = ext3_journal_current_handle(); in ext3_ordered_write_end() local
1387 ret = walk_page_buffers(handle, page_buffers(page), in ext3_ordered_write_end()
1397 ext3_orphan_add(handle, inode); in ext3_ordered_write_end()
1398 ret2 = ext3_journal_stop(handle); in ext3_ordered_write_end()
1414 handle_t *handle = ext3_journal_current_handle(); in ext3_writeback_write_end() local
1426 ext3_orphan_add(handle, inode); in ext3_writeback_write_end()
1427 ret = ext3_journal_stop(handle); in ext3_writeback_write_end()
1441 handle_t *handle = ext3_journal_current_handle(); in ext3_journalled_write_end() local
1459 ret = walk_page_buffers(handle, page_buffers(page), from, in ext3_journalled_write_end()
1471 ext3_orphan_add(handle, inode); in ext3_journalled_write_end()
1473 atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid); in ext3_journalled_write_end()
1476 ret2 = ext3_mark_inode_dirty(handle, inode); in ext3_journalled_write_end()
1481 ret2 = ext3_journal_stop(handle); in ext3_journalled_write_end()
1544 static int bget_one(handle_t *handle, struct buffer_head *bh) in bget_one() argument
1550 static int bput_one(handle_t *handle, struct buffer_head *bh) in bput_one() argument
1556 static int buffer_unmapped(handle_t *handle, struct buffer_head *bh) in buffer_unmapped() argument
1579 handle_t *handle = NULL; in ext3_ordered_writepage() local
1613 handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode)); in ext3_ordered_writepage()
1615 if (IS_ERR(handle)) { in ext3_ordered_writepage()
1616 ret = PTR_ERR(handle); in ext3_ordered_writepage()
1620 walk_page_buffers(handle, page_bufs, 0, in ext3_ordered_writepage()
1638 ret = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE, in ext3_ordered_writepage()
1640 walk_page_buffers(handle, page_bufs, 0, in ext3_ordered_writepage()
1642 err = ext3_journal_stop(handle); in ext3_ordered_writepage()
1657 handle_t *handle = NULL; in ext3_writeback_writepage() local
1683 handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode)); in ext3_writeback_writepage()
1684 if (IS_ERR(handle)) { in ext3_writeback_writepage()
1685 ret = PTR_ERR(handle); in ext3_writeback_writepage()
1691 err = ext3_journal_stop(handle); in ext3_writeback_writepage()
1706 handle_t *handle = NULL; in ext3_journalled_writepage() local
1724 handle = ext3_journal_start(inode, in ext3_journalled_writepage()
1726 if (IS_ERR(handle)) { in ext3_journalled_writepage()
1727 ret = PTR_ERR(handle); in ext3_journalled_writepage()
1738 ext3_journal_stop(handle); in ext3_journalled_writepage()
1741 ret = walk_page_buffers(handle, page_buffers(page), 0, in ext3_journalled_writepage()
1744 err = walk_page_buffers(handle, page_buffers(page), 0, in ext3_journalled_writepage()
1750 handle->h_transaction->t_tid); in ext3_journalled_writepage()
1752 err = ext3_journal_stop(handle); in ext3_journalled_writepage()
1829 handle_t *handle; in ext3_direct_IO() local
1842 handle = ext3_journal_start(inode, 2); in ext3_direct_IO()
1843 if (IS_ERR(handle)) { in ext3_direct_IO()
1844 ret = PTR_ERR(handle); in ext3_direct_IO()
1847 ret = ext3_orphan_add(handle, inode); in ext3_direct_IO()
1849 ext3_journal_stop(handle); in ext3_direct_IO()
1854 ext3_journal_stop(handle); in ext3_direct_IO()
1878 handle = ext3_journal_start(inode, 2); in ext3_direct_IO()
1879 if (IS_ERR(handle)) { in ext3_direct_IO()
1884 ret = PTR_ERR(handle); in ext3_direct_IO()
1890 ext3_orphan_del(handle, inode); in ext3_direct_IO()
1903 ext3_mark_inode_dirty(handle, inode); in ext3_direct_IO()
1906 err = ext3_journal_stop(handle); in ext3_direct_IO()
2001 handle_t *handle = NULL; in ext3_block_truncate_page() local
2058 handle = ext3_journal_start(inode, 1); in ext3_block_truncate_page()
2059 if (IS_ERR(handle)) { in ext3_block_truncate_page()
2062 err = PTR_ERR(handle); in ext3_block_truncate_page()
2069 err = ext3_journal_get_write_access(handle, bh); in ext3_block_truncate_page()
2079 err = ext3_journal_dirty_metadata(handle, bh); in ext3_block_truncate_page()
2082 err = ext3_journal_dirty_data(handle, bh); in ext3_block_truncate_page()
2086 if (handle) in ext3_block_truncate_page()
2087 ext3_journal_stop(handle); in ext3_block_truncate_page()
2199 static void ext3_clear_blocks(handle_t *handle, struct inode *inode, in ext3_clear_blocks() argument
2204 if (try_to_extend_transaction(handle, inode)) { in ext3_clear_blocks()
2207 if (ext3_journal_dirty_metadata(handle, bh)) in ext3_clear_blocks()
2210 ext3_mark_inode_dirty(handle, inode); in ext3_clear_blocks()
2211 truncate_restart_transaction(handle, inode); in ext3_clear_blocks()
2214 if (ext3_journal_get_write_access(handle, bh)) in ext3_clear_blocks()
2234 ext3_forget(handle, 0, inode, bh, nr); in ext3_clear_blocks()
2238 ext3_free_blocks(handle, inode, block_to_free, count); in ext3_clear_blocks()
2260 static void ext3_free_data(handle_t *handle, struct inode *inode, in ext3_free_data() argument
2276 err = ext3_journal_get_write_access(handle, this_bh); in ext3_free_data()
2294 ext3_clear_blocks(handle, inode, this_bh, in ext3_free_data()
2305 ext3_clear_blocks(handle, inode, this_bh, block_to_free, in ext3_free_data()
2318 ext3_journal_dirty_metadata(handle, this_bh); in ext3_free_data()
2341 static void ext3_free_branches(handle_t *handle, struct inode *inode, in ext3_free_branches() argument
2348 if (is_handle_aborted(handle)) in ext3_free_branches()
2376 ext3_free_branches(handle, inode, bh, in ext3_free_branches()
2397 if (is_handle_aborted(handle)) in ext3_free_branches()
2399 if (try_to_extend_transaction(handle, inode)) { in ext3_free_branches()
2400 ext3_mark_inode_dirty(handle, inode); in ext3_free_branches()
2401 truncate_restart_transaction(handle, inode); in ext3_free_branches()
2427 ext3_forget(handle, 1, inode, bh, bh->b_blocknr); in ext3_free_branches()
2429 ext3_free_blocks(handle, inode, nr, 1); in ext3_free_branches()
2437 if (!ext3_journal_get_write_access(handle, in ext3_free_branches()
2442 ext3_journal_dirty_metadata(handle, in ext3_free_branches()
2450 ext3_free_data(handle, inode, parent_bh, first, last); in ext3_free_branches()
2495 handle_t *handle; in ext3_truncate() local
2515 handle = start_transaction(inode); in ext3_truncate()
2516 if (IS_ERR(handle)) in ext3_truncate()
2534 if (ext3_orphan_add(handle, inode)) in ext3_truncate()
2553 ext3_free_data(handle, inode, NULL, i_data+offsets[0], in ext3_truncate()
2563 ext3_free_branches(handle, inode, NULL, in ext3_truncate()
2572 ext3_free_branches(handle, inode, partial->bh, in ext3_truncate()
2579 ext3_free_branches(handle, inode, partial->bh, partial->p + 1, in ext3_truncate()
2592 ext3_free_branches(handle, inode, NULL, &nr, &nr+1, 1); in ext3_truncate()
2598 ext3_free_branches(handle, inode, NULL, &nr, &nr+1, 2); in ext3_truncate()
2604 ext3_free_branches(handle, inode, NULL, &nr, &nr+1, 3); in ext3_truncate()
2615 ext3_mark_inode_dirty(handle, inode); in ext3_truncate()
2622 handle->h_sync = 1; in ext3_truncate()
2632 ext3_orphan_del(handle, inode); in ext3_truncate()
2634 ext3_journal_stop(handle); in ext3_truncate()
3032 static int ext3_do_update_inode(handle_t *handle, in ext3_do_update_inode() argument
3118 err = ext3_journal_get_write_access(handle, in ext3_do_update_inode()
3126 handle->h_sync = 1; in ext3_do_update_inode()
3127 err = ext3_journal_dirty_metadata(handle, in ext3_do_update_inode()
3154 rc = ext3_journal_dirty_metadata(handle, bh); in ext3_do_update_inode()
3159 atomic_set(&ei->i_sync_tid, handle->h_transaction->t_tid); in ext3_do_update_inode()
3161 atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid); in ext3_do_update_inode()
3255 handle_t *handle; in ext3_setattr() local
3259 handle = ext3_journal_start(inode, EXT3_MAXQUOTAS_INIT_BLOCKS(inode->i_sb)+ in ext3_setattr()
3261 if (IS_ERR(handle)) { in ext3_setattr()
3262 error = PTR_ERR(handle); in ext3_setattr()
3267 ext3_journal_stop(handle); in ext3_setattr()
3276 error = ext3_mark_inode_dirty(handle, inode); in ext3_setattr()
3277 ext3_journal_stop(handle); in ext3_setattr()
3285 handle_t *handle; in ext3_setattr() local
3287 handle = ext3_journal_start(inode, 3); in ext3_setattr()
3288 if (IS_ERR(handle)) { in ext3_setattr()
3289 error = PTR_ERR(handle); in ext3_setattr()
3293 error = ext3_orphan_add(handle, inode); in ext3_setattr()
3295 ext3_journal_stop(handle); in ext3_setattr()
3299 error = ext3_mark_inode_dirty(handle, inode); in ext3_setattr()
3300 ext3_journal_stop(handle); in ext3_setattr()
3309 handle = ext3_journal_start(inode, 3); in ext3_setattr()
3310 if (IS_ERR(handle)) { in ext3_setattr()
3314 ext3_orphan_del(handle, inode); in ext3_setattr()
3315 ext3_journal_stop(handle); in ext3_setattr()
3391 int ext3_mark_iloc_dirty(handle_t *handle, in ext3_mark_iloc_dirty() argument
3400 err = ext3_do_update_inode(handle, inode, iloc); in ext3_mark_iloc_dirty()
3411 ext3_reserve_inode_write(handle_t *handle, struct inode *inode, in ext3_reserve_inode_write() argument
3415 if (handle) { in ext3_reserve_inode_write()
3419 err = ext3_journal_get_write_access(handle, iloc->bh); in ext3_reserve_inode_write()
3443 int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode) in ext3_mark_inode_dirty() argument
3450 err = ext3_reserve_inode_write(handle, inode, &iloc); in ext3_mark_inode_dirty()
3452 err = ext3_mark_iloc_dirty(handle, inode, &iloc); in ext3_mark_inode_dirty()
3473 handle_t *handle; in ext3_dirty_inode() local
3475 handle = ext3_journal_start(inode, 2); in ext3_dirty_inode()
3476 if (IS_ERR(handle)) in ext3_dirty_inode()
3479 current_handle->h_transaction != handle->h_transaction) { in ext3_dirty_inode()
3486 ext3_mark_inode_dirty(handle, inode); in ext3_dirty_inode()
3488 ext3_journal_stop(handle); in ext3_dirty_inode()
3501 static int ext3_pin_inode(handle_t *handle, struct inode *inode)
3506 if (handle) {
3510 err = journal_get_write_access(handle, iloc.bh);
3512 err = ext3_journal_dirty_metadata(handle,
3525 handle_t *handle; in ext3_change_inode_journal_flag() local
3563 handle = ext3_journal_start(inode, 1); in ext3_change_inode_journal_flag()
3564 if (IS_ERR(handle)) in ext3_change_inode_journal_flag()
3565 return PTR_ERR(handle); in ext3_change_inode_journal_flag()
3567 err = ext3_mark_inode_dirty(handle, inode); in ext3_change_inode_journal_flag()
3568 handle->h_sync = 1; in ext3_change_inode_journal_flag()
3569 ext3_journal_stop(handle); in ext3_change_inode_journal_flag()