#include "xfs_scrub.h"
#include "common.h"
#include "inodes.h"
+#include "fsgeom.h"
+#include "libfrog/bulkstat.h"
/*
* Iterate a range of inodes.
struct xfs_inogrp *inogrp,
struct xfs_bstat *bstat)
{
- struct xfs_fsop_bulkreq onereq = {NULL};
struct xfs_bstat *bs;
- __u64 oneino;
- __s32 onelen = 0;
int i;
int error;
- onereq.lastip = &oneino;
- onereq.icount = 1;
- onereq.ocount = &onelen;
-
for (i = 0, bs = bstat; i < XFS_INODES_PER_CHUNK; i++) {
if (!(inogrp->xi_allocmask & (1ULL << i)))
continue;
}
/* Load the one inode. */
- oneino = inogrp->xi_startino + i;
- onereq.ubuffer = bs;
- error = ioctl(ctx->mnt.fd, XFS_IOC_FSBULKSTAT_SINGLE,
- &onereq);
+ error = xfrog_bulkstat_single(&ctx->mnt,
+ inogrp->xi_startino + i, bs);
if (error || bs->bs_ino != inogrp->xi_startino + i) {
memset(bs, 0, sizeof(struct xfs_bstat));
bs->bs_ino = inogrp->xi_startino + i;
void *arg)
{
struct xfs_fsop_bulkreq igrpreq = {NULL};
- struct xfs_fsop_bulkreq bulkreq = {NULL};
struct xfs_handle handle;
struct xfs_inogrp inogrp;
struct xfs_bstat bstat[XFS_INODES_PER_CHUNK];
char idescr[DESCR_BUFSZ];
- char buf[DESCR_BUFSZ];
struct xfs_bstat *bs;
__u64 igrp_ino;
- __u64 ino;
- __s32 bulklen = 0;
+ uint64_t ino;
+ uint32_t bulklen = 0;
__s32 igrplen = 0;
bool moveon = true;
int i;
memset(bstat, 0, XFS_INODES_PER_CHUNK * sizeof(struct xfs_bstat));
- bulkreq.lastip = &ino;
- bulkreq.icount = XFS_INODES_PER_CHUNK;
- bulkreq.ubuffer = &bstat;
- bulkreq.ocount = &bulklen;
igrpreq.lastip = &igrp_ino;
igrpreq.icount = 1;
while (!error && igrplen) {
/* Load the inodes. */
ino = inogrp.xi_startino - 1;
- bulkreq.icount = inogrp.xi_alloccount;
+
/*
* We can have totally empty inode chunks on filesystems where
* there are more than 64 inodes per block. Skip these.
*/
if (inogrp.xi_alloccount == 0)
goto igrp_retry;
- error = ioctl(ctx->mnt.fd, XFS_IOC_FSBULKSTAT, &bulkreq);
- if (error)
- str_info(ctx, descr, "%s", strerror_r(errno,
- buf, DESCR_BUFSZ));
+ error = xfrog_bulkstat(&ctx->mnt, &ino, inogrp.xi_alloccount,
+ bstat, &bulklen);
+ if (error) {
+ char errbuf[DESCR_BUFSZ];
+
+ str_info(ctx, descr, "%s", strerror_r(error,
+ errbuf, DESCR_BUFSZ));
+ }
xfs_iterate_inodes_range_check(ctx, &inogrp, bstat);