Lines Matching defs:inode

11 #include "inode.h"
43 struct inode *inode;
60 struct inode *inode,
394 static int ocfs2_get_refcount_block(struct inode *inode, u64 *ref_blkno)
400 ret = ocfs2_read_inode_block(inode, &di_bh);
406 BUG_ON(!ocfs2_is_refcount_inode(inode));
546 * Create a refcount tree for an inode.
547 * We take for granted that the inode is already locked.
549 static int ocfs2_create_refcount_tree(struct inode *inode,
556 struct ocfs2_inode_info *oi = OCFS2_I(inode);
557 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
565 BUG_ON(ocfs2_is_refcount_inode(inode));
583 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
605 new_bh = sb_getblk(inode->i_sb, first_blkno);
622 memset(rb, 0, inode->i_sb->s_blocksize);
690 static int ocfs2_set_refcount_tree(struct inode *inode,
697 struct ocfs2_inode_info *oi = OCFS2_I(inode);
698 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
703 BUG_ON(ocfs2_is_refcount_inode(inode));
719 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
754 int ocfs2_remove_refcount_tree(struct inode *inode, struct buffer_head *di_bh)
759 struct ocfs2_inode_info *oi = OCFS2_I(inode);
760 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
762 struct inode *alloc_inode = NULL;
770 if (!ocfs2_is_refcount_inode(inode))
820 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
923 int ocfs2_try_remove_refcount_tree(struct inode *inode,
927 struct ocfs2_inode_info *oi = OCFS2_I(inode);
940 ocfs2_has_inline_xattr_value_outside(inode, di))
943 ret = ocfs2_remove_refcount_tree(inode, di_bh);
2286 int ocfs2_decrease_refcount(struct inode *inode,
2297 BUG_ON(!ocfs2_is_refcount_inode(inode));
2299 ret = ocfs2_get_refcount_block(inode, &ref_blkno);
2305 ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno, &tree);
2336 static int ocfs2_mark_extent_refcounted(struct inode *inode,
2345 trace_ocfs2_mark_extent_refcounted(OCFS2_I(inode)->ip_blkno,
2348 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
2349 ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
2350 inode->i_ino);
2519 int ocfs2_prepare_refcount_change_for_del(struct inode *inode,
2529 u64 start_cpos = ocfs2_blocks_to_clusters(inode->i_sb, phys_blkno);
2531 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
2532 ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
2533 inode->i_ino);
2537 BUG_ON(!ocfs2_is_refcount_inode(inode));
2539 ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb),
2553 ret = ocfs2_calc_refcount_meta_credits(inode->i_sb,
2627 static int ocfs2_refcount_cal_cow_clusters(struct inode *inode,
2641 int contig_clusters = ocfs2_cow_contig_clusters(inode->i_sb);
2647 ret = ocfs2_find_leaf(INODE_CACHE(inode), el, cpos, &eb_bh);
2657 ret = ocfs2_error(inode->i_sb,
2659 inode->i_ino,
2671 "index %d\n", inode->i_ino, i);
2736 want_clusters = ocfs2_cow_align_length(inode->i_sb,
2769 *cow_start = ocfs2_cow_align_start(inode->i_sb,
2781 *cow_start = ocfs2_cow_align_start(inode->i_sb,
2785 want_clusters = ocfs2_cow_align_length(inode->i_sb,
2806 ret = ocfs2_read_extent_block(INODE_CACHE(inode),
2904 struct inode *inode,
2909 struct super_block *sb = inode->i_sb;
2915 struct address_space *mapping = inode->i_mapping;
2926 if (end > i_size_read(inode))
2927 end = i_size_read(inode);
2985 ocfs2_map_and_dirty_page(inode,
3002 struct inode *inode,
3007 struct super_block *sb = inode->i_sb;
3008 struct ocfs2_caching_info *ci = INODE_CACHE(inode);
3129 ret = context->cow_duplicate_clusters(handle, context->inode,
3147 struct inode *inode,
3153 if (ocfs2_should_order_data(inode))
3159 ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
3171 return ocfs2_get_clusters(context->inode, v_cluster, p_cluster,
3290 ret = context->post_refcount->func(context->inode, handle,
3303 ret = ocfs2_cow_sync_writeback(sb, context->inode, cpos,
3329 struct inode *inode = context->inode;
3333 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3336 return ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
3337 inode->i_ino);
3355 ret = ocfs2_make_clusters_writable(inode->i_sb, context,
3380 static int ocfs2_refcount_cow_hunk(struct inode *inode,
3386 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3392 BUG_ON(!ocfs2_is_refcount_inode(inode));
3394 ret = ocfs2_refcount_cal_cow_clusters(inode, &di->id2.i_list,
3402 trace_ocfs2_refcount_cow_hunk(OCFS2_I(inode)->ip_blkno,
3422 context->inode = inode;
3431 INODE_CACHE(inode), di_bh);
3442 ocfs2_extent_map_trunc(inode, cow_start);
3456 int ocfs2_refcount_cow(struct inode *inode,
3465 ret = ocfs2_get_clusters(inode, cpos, &p_cluster,
3476 ret = ocfs2_refcount_cow_hunk(inode, di_bh, cpos,
3496 struct inode *inode = context->inode;
3499 return ocfs2_xattr_get_clusters(inode, v_cluster, p_cluster,
3508 int ocfs2_refcounted_xattr_delete_need(struct inode *inode,
3522 ret = ocfs2_xattr_get_clusters(inode, cpos, &p_cluster,
3580 *credits += ocfs2_calc_extend_credits(inode->i_sb,
3592 int ocfs2_refcount_cow_xattr(struct inode *inode,
3605 BUG_ON(!ocfs2_is_refcount_inode(inode));
3607 ret = ocfs2_refcount_cal_cow_clusters(inode, &xv->xr_list,
3624 context->inode = inode;
3634 ocfs2_clusters_to_blocks(inode->i_sb, 1) * cow_len;
3639 INODE_CACHE(inode), vb);
3654 int ocfs2_add_refcount_flag(struct inode *inode,
3665 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3671 ret = ocfs2_calc_refcount_meta_credits(inode->i_sb,
3701 ret = ocfs2_mark_extent_refcounted(inode, data_et, handle,
3718 ret = post->func(inode, handle, post->para);
3731 static int ocfs2_change_ctime(struct inode *inode,
3738 handle = ocfs2_start_trans(OCFS2_SB(inode->i_sb),
3746 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
3753 inode_set_ctime_current(inode);
3754 di->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec);
3755 di->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec);
3760 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
3765 static int ocfs2_attach_refcount_tree(struct inode *inode,
3770 struct ocfs2_inode_info *oi = OCFS2_I(inode);
3772 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3782 if (!ocfs2_is_refcount_inode(inode)) {
3783 ret = ocfs2_create_refcount_tree(inode, di_bh);
3802 ocfs2_init_dinode_extent_tree(&di_et, INODE_CACHE(inode), di_bh);
3804 size = i_size_read(inode);
3805 clusters = ocfs2_clusters_for_bytes(inode->i_sb, size);
3809 ret = ocfs2_get_clusters(inode, cpos, &p_cluster,
3816 ret = ocfs2_add_refcount_flag(inode, &di_et,
3833 ret = ocfs2_xattr_attach_refcount_tree(inode, di_bh,
3844 ret = ocfs2_change_ctime(inode, di_bh);
3862 ocfs2_extent_map_trunc(inode, 0);
3867 static int ocfs2_add_refcounted_extent(struct inode *inode,
3878 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3881 ret = ocfs2_lock_refcount_allocators(inode->i_sb,
3899 ocfs2_clusters_to_blocks(inode->i_sb, p_cluster),
3914 ret = dquot_alloc_space_nodirty(inode,
3927 static int ocfs2_duplicate_inline_data(struct inode *s_inode,
3929 struct inode *t_inode,
3970 static int ocfs2_duplicate_extent_list(struct inode *s_inode,
3971 struct inode *t_inode,
4022 static int ocfs2_complete_reflink(struct inode *s_inode,
4024 struct inode *t_inode,
4093 static int ocfs2_create_reflink_node(struct inode *s_inode,
4095 struct inode *t_inode,
4152 struct inode *new_inode,
4156 struct inode *inode = d_inode(old_dentry);
4159 if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) {
4165 ret = filemap_fdatawrite(inode->i_mapping);
4171 ret = ocfs2_attach_refcount_tree(inode, old_bh);
4185 ret = ocfs2_create_reflink_node(inode, old_bh,
4192 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_XATTR_FL) {
4193 ret = ocfs2_reflink_xattrs(inode, old_bh,
4202 ret = ocfs2_complete_reflink(inode, old_bh,
4214 ret = filemap_fdatawait(inode->i_mapping);
4221 static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir,
4225 struct inode *inode = d_inode(old_dentry);
4227 struct inode *new_orphan_inode = NULL;
4230 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)))
4234 error = ocfs2_create_inode_in_orphan(dir, inode->i_mode,
4241 error = ocfs2_rw_lock(inode, 1);
4247 error = ocfs2_inode_lock(inode, &old_bh, 1);
4250 ocfs2_rw_unlock(inode, 1);
4254 down_write(&OCFS2_I(inode)->ip_xattr_sem);
4255 down_write(&OCFS2_I(inode)->ip_alloc_sem);
4258 up_write(&OCFS2_I(inode)->ip_alloc_sem);
4259 up_write(&OCFS2_I(inode)->ip_xattr_sem);
4261 ocfs2_inode_unlock(inode, 1);
4262 ocfs2_rw_unlock(inode, 1);
4296 * We need to open_unlock the inode no matter whether we
4314 static inline int ocfs2_may_create(struct inode *dir, struct dentry *child)
4326 * @old_dentry: source dentry + inode
4331 static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir,
4334 struct inode *inode = d_inode(old_dentry);
4337 if (!inode)
4344 if (dir->i_sb != inode->i_sb)
4350 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
4354 if (!S_ISREG(inode->i_mode))
4362 if (!uid_eq(current_fsuid(), inode->i_uid) && !capable(CAP_CHOWN))
4364 if (!in_group_p(inode->i_gid) && !capable(CAP_CHOWN))
4374 error = inode_permission(&nop_mnt_idmap, inode, MAY_READ);
4379 inode_lock(inode);
4383 inode_unlock(inode);
4391 int ocfs2_reflink_ioctl(struct inode *inode,
4400 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)))
4433 /* Update destination inode size, if necessary. */
4434 int ocfs2_reflink_update_dest(struct inode *dest,
4473 static loff_t ocfs2_reflink_remap_extent(struct inode *s_inode,
4476 struct inode *t_inode,
4587 loff_t ocfs2_reflink_remap_blocks(struct inode *s_inode,
4590 struct inode *t_inode,
4631 /* Neither inode has a refcount tree. Add one to s_inode. */
4685 /* Lock an inode and grab a bh pointing to the inode. */
4686 int ocfs2_reflink_inodes_lock(struct inode *s_inode,
4688 struct inode *t_inode,
4691 struct inode *inode1 = s_inode;
4692 struct inode *inode2 = t_inode;
4753 * If we swapped inode order above, we have to swap the buffer heads
4780 void ocfs2_reflink_inodes_unlock(struct inode *s_inode,
4782 struct inode *t_inode,