hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/xfs/xfs_linux.h
....@@ -60,6 +60,7 @@
6060 #include <linux/list_sort.h>
6161 #include <linux/ratelimit.h>
6262 #include <linux/rhashtable.h>
63
+#include <linux/xattr.h>
6364
6465 #include <asm/page.h>
6566 #include <asm/div64.h>
....@@ -101,16 +102,10 @@
101102 #define xfs_cowb_secs xfs_params.cowb_timer.val
102103
103104 #define current_cpu() (raw_smp_processor_id())
104
-#define current_pid() (current->pid)
105
-#define current_test_flags(f) (current->flags & (f))
106105 #define current_set_flags_nested(sp, f) \
107106 (*(sp) = current->flags, current->flags |= (f))
108
-#define current_clear_flags_nested(sp, f) \
109
- (*(sp) = current->flags, current->flags &= ~(f))
110107 #define current_restore_flags_nested(sp, f) \
111108 (current->flags = ((current->flags & ~(f)) | (*(sp) & (f))))
112
-
113
-#define spinlock_destroy(lock)
114109
115110 #define NBBY 8 /* number of bits per byte */
116111
....@@ -128,7 +123,6 @@
128123 #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
129124 #define EFSBADCRC EBADMSG /* Bad CRC detected */
130125
131
-#define SYNCHRONIZE() barrier()
132126 #define __return_address __builtin_return_address(0)
133127
134128 /*
....@@ -165,32 +159,6 @@
165159
166160 extern struct xstats xfsstats;
167161
168
-/* Kernel uid/gid conversion. These are used to convert to/from the on disk
169
- * uid_t/gid_t types to the kuid_t/kgid_t types that the kernel uses internally.
170
- * The conversion here is type only, the value will remain the same since we
171
- * are converting to the init_user_ns. The uid is later mapped to a particular
172
- * user namespace value when crossing the kernel/user boundary.
173
- */
174
-static inline uint32_t xfs_kuid_to_uid(kuid_t uid)
175
-{
176
- return from_kuid(&init_user_ns, uid);
177
-}
178
-
179
-static inline kuid_t xfs_uid_to_kuid(uint32_t uid)
180
-{
181
- return make_kuid(&init_user_ns, uid);
182
-}
183
-
184
-static inline uint32_t xfs_kgid_to_gid(kgid_t gid)
185
-{
186
- return from_kgid(&init_user_ns, gid);
187
-}
188
-
189
-static inline kgid_t xfs_gid_to_kgid(uint32_t gid)
190
-{
191
- return make_kgid(&init_user_ns, gid);
192
-}
193
-
194162 static inline dev_t xfs_to_linux_dev_t(xfs_dev_t dev)
195163 {
196164 return MKDEV(sysv_major(dev) & 0x1ff, sysv_minor(dev));
....@@ -207,6 +175,12 @@
207175 #define xfs_sort(a,n,s,fn) sort(a,n,s,fn,NULL)
208176 #define xfs_stack_trace() dump_stack()
209177
178
+static inline uint64_t rounddown_64(uint64_t x, uint32_t y)
179
+{
180
+ do_div(x, y);
181
+ return x * y;
182
+}
183
+
210184 static inline uint64_t roundup_64(uint64_t x, uint32_t y)
211185 {
212186 x += y - 1;
....@@ -221,27 +195,36 @@
221195 return x;
222196 }
223197
198
+int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
199
+ char *data, unsigned int op);
200
+
224201 #define ASSERT_ALWAYS(expr) \
225
- (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
202
+ (likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
226203
227204 #ifdef DEBUG
228205 #define ASSERT(expr) \
229
- (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
206
+ (likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
230207
231208 #else /* !DEBUG */
232209
233210 #ifdef XFS_WARN
234211
235212 #define ASSERT(expr) \
236
- (likely(expr) ? (void)0 : asswarn(#expr, __FILE__, __LINE__))
213
+ (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
237214
238215 #else /* !DEBUG && !XFS_WARN */
239216
240
-#define ASSERT(expr) ((void)0)
217
+#define ASSERT(expr) ((void)0)
241218
242219 #endif /* XFS_WARN */
243220 #endif /* DEBUG */
244221
222
+#define XFS_IS_CORRUPT(mp, expr) \
223
+ (unlikely(expr) ? xfs_corruption_error(#expr, XFS_ERRLEVEL_LOW, (mp), \
224
+ NULL, 0, __FILE__, __LINE__, \
225
+ __this_address), \
226
+ true : false)
227
+
245228 #define STATIC static noinline
246229
247230 #ifdef CONFIG_XFS_RT