hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/xfs/libxfs/xfs_da_btree.h
....@@ -1,4 +1,4 @@
1
-// SPDX-License-Identifier: GPL-2.0
1
+/* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc.
44 * Copyright (c) 2013 Red Hat, Inc.
....@@ -10,7 +10,6 @@
1010 struct xfs_inode;
1111 struct xfs_trans;
1212 struct zone;
13
-struct xfs_dir_ops;
1413
1514 /*
1615 * Directory/attribute geometry information. There will be one of these for each
....@@ -18,15 +17,23 @@
1817 * structures will be attached to the xfs_mount.
1918 */
2019 struct xfs_da_geometry {
21
- int blksize; /* da block size in bytes */
22
- int fsbcount; /* da block size in filesystem blocks */
20
+ unsigned int blksize; /* da block size in bytes */
21
+ unsigned int fsbcount; /* da block size in filesystem blocks */
2322 uint8_t fsblog; /* log2 of _filesystem_ block size */
2423 uint8_t blklog; /* log2 of da block size */
25
- uint node_ents; /* # of entries in a danode */
26
- int magicpct; /* 37% of block size in bytes */
24
+ unsigned int node_hdr_size; /* danode header size in bytes */
25
+ unsigned int node_ents; /* # of entries in a danode */
26
+ unsigned int magicpct; /* 37% of block size in bytes */
2727 xfs_dablk_t datablk; /* blockno of dir data v2 */
28
+ unsigned int leaf_hdr_size; /* dir2 leaf header size */
29
+ unsigned int leaf_max_ents; /* # of entries in dir2 leaf */
2830 xfs_dablk_t leafblk; /* blockno of leaf data v2 */
31
+ unsigned int free_hdr_size; /* dir2 free header size */
32
+ unsigned int free_max_bests; /* # of bests entries in dir2 free */
2933 xfs_dablk_t freeblk; /* blockno of free data v2 */
34
+
35
+ xfs_dir2_data_aoff_t data_first_offset;
36
+ size_t data_entry_offset;
3037 };
3138
3239 /*========================================================================
....@@ -50,9 +57,10 @@
5057 const uint8_t *name; /* string (maybe not NULL terminated) */
5158 int namelen; /* length of string (maybe no NULL) */
5259 uint8_t filetype; /* filetype of inode for directories */
53
- uint8_t *value; /* set of bytes (maybe contain NULLs) */
60
+ void *value; /* set of bytes (maybe contain NULLs) */
5461 int valuelen; /* length of value */
55
- int flags; /* argument flags (eg: ATTR_NOCREATE) */
62
+ unsigned int attr_filter; /* XFS_ATTR_{ROOT,SECURE,INCOMPLETE} */
63
+ unsigned int attr_flags; /* XATTR_{CREATE,REPLACE} */
5664 xfs_dahash_t hashval; /* hash value of name */
5765 xfs_ino_t inumber; /* input/output inode number */
5866 struct xfs_inode *dp; /* directory inode to manipulate */
....@@ -81,13 +89,15 @@
8189 #define XFS_DA_OP_ADDNAME 0x0004 /* this is an add operation */
8290 #define XFS_DA_OP_OKNOENT 0x0008 /* lookup/add op, ENOENT ok, else die */
8391 #define XFS_DA_OP_CILOOKUP 0x0010 /* lookup to return CI name if found */
92
+#define XFS_DA_OP_NOTIME 0x0020 /* don't update inode timestamps */
8493
8594 #define XFS_DA_OP_FLAGS \
8695 { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \
8796 { XFS_DA_OP_RENAME, "RENAME" }, \
8897 { XFS_DA_OP_ADDNAME, "ADDNAME" }, \
8998 { XFS_DA_OP_OKNOENT, "OKNOENT" }, \
90
- { XFS_DA_OP_CILOOKUP, "CILOOKUP" }
99
+ { XFS_DA_OP_CILOOKUP, "CILOOKUP" }, \
100
+ { XFS_DA_OP_NOTIME, "NOTIME" }
91101
92102 /*
93103 * Storage for holding state during Btree searches and split/join ops.
....@@ -123,22 +133,31 @@
123133 } xfs_da_state_t;
124134
125135 /*
136
+ * In-core version of the node header to abstract the differences in the v2 and
137
+ * v3 disk format of the headers. Callers need to convert to/from disk format as
138
+ * appropriate.
139
+ */
140
+struct xfs_da3_icnode_hdr {
141
+ uint32_t forw;
142
+ uint32_t back;
143
+ uint16_t magic;
144
+ uint16_t count;
145
+ uint16_t level;
146
+
147
+ /*
148
+ * Pointer to the on-disk format entries, which are behind the
149
+ * variable size (v4 vs v5) header in the on-disk block.
150
+ */
151
+ struct xfs_da_node_entry *btree;
152
+};
153
+
154
+/*
126155 * Utility macros to aid in logging changed structure fields.
127156 */
128157 #define XFS_DA_LOGOFF(BASE, ADDR) ((char *)(ADDR) - (char *)(BASE))
129158 #define XFS_DA_LOGRANGE(BASE, ADDR, SIZE) \
130159 (uint)(XFS_DA_LOGOFF(BASE, ADDR)), \
131160 (uint)(XFS_DA_LOGOFF(BASE, ADDR)+(SIZE)-1)
132
-
133
-/*
134
- * Name ops for directory and/or attr name operations
135
- */
136
-struct xfs_nameops {
137
- xfs_dahash_t (*hashname)(struct xfs_name *);
138
- enum xfs_dacmp (*compname)(struct xfs_da_args *,
139
- const unsigned char *, int);
140
-};
141
-
142161
143162 /*========================================================================
144163 * Function prototypes.
....@@ -170,25 +189,28 @@
170189 int xfs_da3_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
171190 xfs_da_state_blk_t *new_blk);
172191 int xfs_da3_node_read(struct xfs_trans *tp, struct xfs_inode *dp,
173
- xfs_dablk_t bno, xfs_daddr_t mappedbno,
174
- struct xfs_buf **bpp, int which_fork);
192
+ xfs_dablk_t bno, struct xfs_buf **bpp, int whichfork);
193
+int xfs_da3_node_read_mapped(struct xfs_trans *tp, struct xfs_inode *dp,
194
+ xfs_daddr_t mappedbno, struct xfs_buf **bpp,
195
+ int whichfork);
175196
176197 /*
177198 * Utility routines.
178199 */
200
+
201
+#define XFS_DABUF_MAP_HOLE_OK (1 << 0)
202
+
179203 int xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno);
180204 int xfs_da_grow_inode_int(struct xfs_da_args *args, xfs_fileoff_t *bno,
181205 int count);
182206 int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp,
183
- xfs_dablk_t bno, xfs_daddr_t mappedbno,
184
- struct xfs_buf **bp, int whichfork);
207
+ xfs_dablk_t bno, struct xfs_buf **bp, int whichfork);
185208 int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp,
186
- xfs_dablk_t bno, xfs_daddr_t mappedbno,
187
- struct xfs_buf **bpp, int whichfork,
188
- const struct xfs_buf_ops *ops);
209
+ xfs_dablk_t bno, unsigned int flags, struct xfs_buf **bpp,
210
+ int whichfork, const struct xfs_buf_ops *ops);
189211 int xfs_da_reada_buf(struct xfs_inode *dp, xfs_dablk_t bno,
190
- xfs_daddr_t mapped_bno, int whichfork,
191
- const struct xfs_buf_ops *ops);
212
+ unsigned int flags, int whichfork,
213
+ const struct xfs_buf_ops *ops);
192214 int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
193215 struct xfs_buf *dead_buf);
194216
....@@ -197,10 +219,14 @@
197219 const unsigned char *name, int len);
198220
199221
200
-xfs_da_state_t *xfs_da_state_alloc(void);
222
+struct xfs_da_state *xfs_da_state_alloc(struct xfs_da_args *args);
201223 void xfs_da_state_free(xfs_da_state_t *state);
202224
225
+void xfs_da3_node_hdr_from_disk(struct xfs_mount *mp,
226
+ struct xfs_da3_icnode_hdr *to, struct xfs_da_intnode *from);
227
+void xfs_da3_node_hdr_to_disk(struct xfs_mount *mp,
228
+ struct xfs_da_intnode *to, struct xfs_da3_icnode_hdr *from);
229
+
203230 extern struct kmem_zone *xfs_da_state_zone;
204
-extern const struct xfs_nameops xfs_default_nameops;
205231
206232 #endif /* __XFS_DA_BTREE_H__ */