Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * extent_map.h
0004  *
0005  * In-memory file extent mappings for OCFS2.
0006  *
0007  * Copyright (C) 2004 Oracle.  All rights reserved.
0008  */
0009 
0010 #ifndef _EXTENT_MAP_H
0011 #define _EXTENT_MAP_H
0012 
0013 struct ocfs2_extent_map_item {
0014     unsigned int            ei_cpos;
0015     unsigned int            ei_phys;
0016     unsigned int            ei_clusters;
0017     unsigned int            ei_flags;
0018 
0019     struct list_head        ei_list;
0020 };
0021 
0022 #define OCFS2_MAX_EXTENT_MAP_ITEMS          3
0023 struct ocfs2_extent_map {
0024     unsigned int            em_num_items;
0025     struct list_head        em_list;
0026 };
0027 
0028 void ocfs2_extent_map_init(struct inode *inode);
0029 void ocfs2_extent_map_trunc(struct inode *inode, unsigned int cluster);
0030 void ocfs2_extent_map_insert_rec(struct inode *inode,
0031                  struct ocfs2_extent_rec *rec);
0032 
0033 int ocfs2_get_clusters(struct inode *inode, u32 v_cluster, u32 *p_cluster,
0034                u32 *num_clusters, unsigned int *extent_flags);
0035 int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno,
0036                 u64 *ret_count, unsigned int *extent_flags);
0037 
0038 int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
0039          u64 map_start, u64 map_len);
0040 
0041 int ocfs2_overwrite_io(struct inode *inode, struct buffer_head *di_bh,
0042                u64 map_start, u64 map_len);
0043 
0044 int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin);
0045 
0046 int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
0047                  u32 *p_cluster, u32 *num_clusters,
0048                  struct ocfs2_extent_list *el,
0049                  unsigned int *extent_flags);
0050 
0051 int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,
0052                struct buffer_head *bhs[], int flags,
0053                int (*validate)(struct super_block *sb,
0054                        struct buffer_head *bh));
0055 int ocfs2_figure_hole_clusters(struct ocfs2_caching_info *ci,
0056                    struct ocfs2_extent_list *el,
0057                    struct buffer_head *eb_bh,
0058                    u32 v_cluster,
0059                    u32 *num_clusters);
0060 static inline int ocfs2_read_virt_block(struct inode *inode, u64 v_block,
0061                     struct buffer_head **bh,
0062                     int (*validate)(struct super_block *sb,
0063                             struct buffer_head *bh))
0064 {
0065     int status = 0;
0066 
0067     if (bh == NULL) {
0068         printk("ocfs2: bh == NULL\n");
0069         status = -EINVAL;
0070         goto bail;
0071     }
0072 
0073     status = ocfs2_read_virt_blocks(inode, v_block, 1, bh, 0, validate);
0074 
0075 bail:
0076     return status;
0077 }
0078 
0079 
0080 #endif  /* _EXTENT_MAP_H */