0001
0002
0003
0004
0005
0006
0007 #ifndef OCFS2_REFCOUNTTREE_H
0008 #define OCFS2_REFCOUNTTREE_H
0009
0010 struct ocfs2_refcount_tree {
0011 struct rb_node rf_node;
0012 u64 rf_blkno;
0013 u32 rf_generation;
0014 struct kref rf_getcnt;
0015 struct rw_semaphore rf_sem;
0016 struct ocfs2_lock_res rf_lockres;
0017 int rf_removed;
0018
0019
0020 spinlock_t rf_lock;
0021 struct ocfs2_caching_info rf_ci;
0022 struct mutex rf_io_mutex;
0023 struct super_block *rf_sb;
0024 };
0025
0026 void ocfs2_purge_refcount_trees(struct ocfs2_super *osb);
0027 int ocfs2_lock_refcount_tree(struct ocfs2_super *osb, u64 ref_blkno, int rw,
0028 struct ocfs2_refcount_tree **tree,
0029 struct buffer_head **ref_bh);
0030 void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb,
0031 struct ocfs2_refcount_tree *tree,
0032 int rw);
0033
0034 int ocfs2_decrease_refcount(struct inode *inode,
0035 handle_t *handle, u32 cpos, u32 len,
0036 struct ocfs2_alloc_context *meta_ac,
0037 struct ocfs2_cached_dealloc_ctxt *dealloc,
0038 int delete);
0039 int ocfs2_prepare_refcount_change_for_del(struct inode *inode,
0040 u64 refcount_loc,
0041 u64 phys_blkno,
0042 u32 clusters,
0043 int *credits,
0044 int *ref_blocks);
0045 int ocfs2_refcount_cow(struct inode *inode,
0046 struct buffer_head *di_bh,
0047 u32 cpos, u32 write_len, u32 max_cpos);
0048
0049 typedef int (ocfs2_post_refcount_func)(struct inode *inode,
0050 handle_t *handle,
0051 void *para);
0052
0053
0054
0055
0056
0057
0058
0059 struct ocfs2_post_refcount {
0060 int credits;
0061 ocfs2_post_refcount_func *func;
0062 void *para;
0063 };
0064
0065 int ocfs2_refcounted_xattr_delete_need(struct inode *inode,
0066 struct ocfs2_caching_info *ref_ci,
0067 struct buffer_head *ref_root_bh,
0068 struct ocfs2_xattr_value_root *xv,
0069 int *meta_add, int *credits);
0070 int ocfs2_refcount_cow_xattr(struct inode *inode,
0071 struct ocfs2_dinode *di,
0072 struct ocfs2_xattr_value_buf *vb,
0073 struct ocfs2_refcount_tree *ref_tree,
0074 struct buffer_head *ref_root_bh,
0075 u32 cpos, u32 write_len,
0076 struct ocfs2_post_refcount *post);
0077 int ocfs2_duplicate_clusters_by_page(handle_t *handle,
0078 struct inode *inode,
0079 u32 cpos, u32 old_cluster,
0080 u32 new_cluster, u32 new_len);
0081 int ocfs2_duplicate_clusters_by_jbd(handle_t *handle,
0082 struct inode *inode,
0083 u32 cpos, u32 old_cluster,
0084 u32 new_cluster, u32 new_len);
0085 int ocfs2_cow_sync_writeback(struct super_block *sb,
0086 struct inode *inode,
0087 u32 cpos, u32 num_clusters);
0088 int ocfs2_add_refcount_flag(struct inode *inode,
0089 struct ocfs2_extent_tree *data_et,
0090 struct ocfs2_caching_info *ref_ci,
0091 struct buffer_head *ref_root_bh,
0092 u32 cpos, u32 p_cluster, u32 num_clusters,
0093 struct ocfs2_cached_dealloc_ctxt *dealloc,
0094 struct ocfs2_post_refcount *post);
0095 int ocfs2_remove_refcount_tree(struct inode *inode, struct buffer_head *di_bh);
0096 int ocfs2_try_remove_refcount_tree(struct inode *inode,
0097 struct buffer_head *di_bh);
0098 int ocfs2_increase_refcount(handle_t *handle,
0099 struct ocfs2_caching_info *ci,
0100 struct buffer_head *ref_root_bh,
0101 u64 cpos, u32 len,
0102 struct ocfs2_alloc_context *meta_ac,
0103 struct ocfs2_cached_dealloc_ctxt *dealloc);
0104 int ocfs2_reflink_ioctl(struct inode *inode,
0105 const char __user *oldname,
0106 const char __user *newname,
0107 bool preserve);
0108 loff_t ocfs2_reflink_remap_blocks(struct inode *s_inode,
0109 struct buffer_head *s_bh,
0110 loff_t pos_in,
0111 struct inode *t_inode,
0112 struct buffer_head *t_bh,
0113 loff_t pos_out,
0114 loff_t len);
0115 int ocfs2_reflink_inodes_lock(struct inode *s_inode,
0116 struct buffer_head **bh1,
0117 struct inode *t_inode,
0118 struct buffer_head **bh2);
0119 void ocfs2_reflink_inodes_unlock(struct inode *s_inode,
0120 struct buffer_head *s_bh,
0121 struct inode *t_inode,
0122 struct buffer_head *t_bh);
0123 int ocfs2_reflink_update_dest(struct inode *dest,
0124 struct buffer_head *d_bh,
0125 loff_t newlen);
0126
0127 #endif