#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#endif
+#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
+
#include <xfs/xfs_types.h>
/* Include deprecated/compat pre-vfs xfs-specific symbols */
#include <xfs/xfs_fs_compat.h>
#ifndef __LIBFROG_BULKSTAT_H__
#define __LIBFROG_BULKSTAT_H__
+/* This is the minimum reasonable size of a bulkstat request. */
+#define LIBFROG_BULKSTAT_CHUNKSIZE \
+ (NBBY * sizeof_field(struct xfs_inumbers, xi_allocmask))
+
/* Bulkstat wrappers */
struct xfs_bstat;
int xfrog_bulkstat_single(struct xfs_fd *xfd, uint64_t ino, unsigned int flags,
#include <sys/statvfs.h>
#include "platform_defs.h"
#include "xfs_arch.h"
-#include "xfs_format.h"
#include "handle.h"
#include "libfrog/paths.h"
#include "libfrog/workqueue.h"
* Check each of the stats we got back to make sure we got the inodes
* we asked for.
*/
- for (i = 0, bs = bstat; i < XFS_INODES_PER_CHUNK; i++) {
+ for (i = 0, bs = bstat; i < LIBFROG_BULKSTAT_CHUNKSIZE; i++) {
if (!(inumbers->xi_allocmask & (1ULL << i)))
continue;
if (bs->bs_ino == inumbers->xi_startino + i) {
sizeof(handle.ha_fid.fid_len);
handle.ha_fid.fid_pad = 0;
- error = -xfrog_bulkstat_alloc_req(XFS_INODES_PER_CHUNK, 0, &breq);
+ error = -xfrog_bulkstat_alloc_req(LIBFROG_BULKSTAT_CHUNKSIZE, 0, &breq);
if (error) {
str_liberror(ctx, error, descr);
si->aborted = true;