xref: /dragonfly/sys/vfs/ext2fs/ext2_extents.c (revision 029e6489)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2010 Zheng Liu <lz@freebsd.org>
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * $FreeBSD$
29  */
30 
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/types.h>
34 #include <sys/kernel.h>
35 #include <sys/malloc.h>
36 #include <sys/vnode.h>
37 #include <sys/bio.h>
38 #include <sys/buf.h>
39 #include <sys/endian.h>
40 #include <sys/conf.h>
41 #include <sys/stat.h>
42 #include <sys/mount.h>
43 #include <sys/mutex.h>
44 
45 #include <vfs/ext2fs/ext2_mount.h>
46 #include <vfs/ext2fs/fs.h>
47 #include <vfs/ext2fs/inode.h>
48 #include <vfs/ext2fs/ext2fs.h>
49 #include <vfs/ext2fs/ext2_extents.h>
50 #include <vfs/ext2fs/ext2_extern.h>
51 
52 SDT_PROVIDER_DECLARE(ext2fs);
53 /*
54  * ext2fs trace probe:
55  * arg0: verbosity. Higher numbers give more verbose messages
56  * arg1: Textual message
57  */
58 SDT_PROBE_DEFINE2(ext2fs, , trace, extents, "int", "char*");
59 
60 #ifdef EXT2FS_PRINT_EXTENTS
61 static void
62 ext4_ext_print_extent(struct ext4_extent *ep)
63 {
64 }
65 
66 static void
67 ext4_ext_print_index(struct inode *ip, struct ext4_extent_index *ex, int do_walk)
68 {
69 }
70 
71 static void
72 ext4_ext_print_header(struct inode *ip, struct ext4_extent_header *ehp)
73 {
74 }
75 
76 static void
77 ext4_ext_print_path(struct inode *ip, struct ext4_extent_path *path)
78 {
79 }
80 
81 void
82 ext4_ext_print_extent_tree_status(struct inode *ip)
83 {
84 }
85 #endif
86 
87 static inline struct ext4_extent_header *
88 ext4_ext_inode_header(struct inode *ip)
89 {
90 	return (NULL);
91 }
92 
93 static inline struct ext4_extent_header *
94 ext4_ext_block_header(char *bdata)
95 {
96 	return (NULL);
97 }
98 
99 static inline unsigned short
100 ext4_ext_inode_depth(struct inode *ip)
101 {
102 	return (0);
103 }
104 
105 static inline e4fs_daddr_t
106 ext4_ext_index_pblock(struct ext4_extent_index *index)
107 {
108 	return (0);
109 }
110 
111 static inline void
112 ext4_index_store_pblock(struct ext4_extent_index *index, e4fs_daddr_t pb)
113 {
114 }
115 
116 static inline e4fs_daddr_t
117 ext4_ext_extent_pblock(struct ext4_extent *extent)
118 {
119 	return (0);
120 }
121 
122 static inline void
123 ext4_ext_store_pblock(struct ext4_extent *ex, e4fs_daddr_t pb)
124 {
125 }
126 
127 int
128 ext4_ext_in_cache(struct inode *ip, daddr_t lbn, struct ext4_extent *ep)
129 {
130 	return (EXT4_EXT_CACHE_NO);
131 }
132 
133 void
134 ext4_ext_path_free(struct ext4_extent_path *path)
135 {
136 }
137 
138 int
139 ext4_ext_find_extent(struct inode *ip, daddr_t block,
140     struct ext4_extent_path **ppath)
141 {
142 	return (EINVAL);
143 }
144 
145 static inline int
146 ext4_ext_space_root(struct inode *ip)
147 {
148 	return (0);
149 }
150 
151 static inline int
152 ext4_ext_space_block(struct inode *ip)
153 {
154 	return (0);
155 }
156 
157 static inline int
158 ext4_ext_space_block_index(struct inode *ip)
159 {
160 	return (0);
161 }
162 
163 void
164 ext4_ext_tree_init(struct inode *ip)
165 {
166 }
167 
168 static inline void
169 ext4_ext_put_in_cache(struct inode *ip, uint32_t blk,
170 			uint32_t len, uint32_t start, int type)
171 {
172 }
173 
174 static inline int
175 ext4_can_extents_be_merged(struct ext4_extent *ex1,
176     struct ext4_extent *ex2)
177 {
178 	return (0);
179 }
180 
181 int
182 ext4_ext_get_blocks(struct inode *ip, e4fs_daddr_t iblk,
183     unsigned long max_blocks, struct ucred *cred, struct buf **bpp,
184     int *pallocated, daddr_t *nb)
185 {
186 	return (EINVAL);
187 }
188 
189 static inline uint16_t
190 ext4_ext_get_actual_len(struct ext4_extent *ext)
191 {
192 	return (0);
193 }
194 
195 static inline struct ext4_extent_header *
196 ext4_ext_header(struct inode *ip)
197 {
198 	return (NULL);
199 }
200 
201 static inline int
202 ext4_ext_more_to_rm(struct ext4_extent_path *path)
203 {
204 	return (0);
205 }
206 
207 int
208 ext4_ext_remove_space(struct inode *ip, off_t length, int flags,
209     struct ucred *cred, struct thread *td)
210 {
211 	return (EINVAL);
212 }
213