2018-06-05 19:42:14 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-16 15:20:36 -07:00
|
|
|
/*
|
2005-11-02 14:58:39 +11:00
|
|
|
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
|
|
|
|
* All Rights Reserved.
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
|
|
|
#include "xfs.h"
|
2005-11-02 14:38:42 +11:00
|
|
|
#include "xfs_fs.h"
|
2013-10-23 10:36:05 +11:00
|
|
|
#include "xfs_shared.h"
|
2013-10-23 10:51:50 +11:00
|
|
|
#include "xfs_format.h"
|
2013-10-23 10:50:10 +11:00
|
|
|
#include "xfs_log_format.h"
|
|
|
|
#include "xfs_trans_resv.h"
|
2005-04-16 15:20:36 -07:00
|
|
|
#include "xfs_mount.h"
|
|
|
|
#include "xfs_inode.h"
|
2013-10-23 10:51:50 +11:00
|
|
|
#include "xfs_btree.h"
|
2005-04-16 15:20:36 -07:00
|
|
|
#include "xfs_ialloc.h"
|
2013-10-23 10:51:50 +11:00
|
|
|
#include "xfs_ialloc_btree.h"
|
2019-07-02 09:39:40 -07:00
|
|
|
#include "xfs_iwalk.h"
|
2005-04-16 15:20:36 -07:00
|
|
|
#include "xfs_itable.h"
|
|
|
|
#include "xfs_error.h"
|
2012-10-08 21:56:11 +11:00
|
|
|
#include "xfs_icache.h"
|
2019-04-12 07:41:18 -07:00
|
|
|
#include "xfs_health.h"
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-06-23 18:11:11 +10:00
|
|
|
/*
|
2019-07-02 09:39:40 -07:00
|
|
|
* Bulk Stat
|
|
|
|
* =========
|
|
|
|
*
|
|
|
|
* Use the inode walking functions to fill out struct xfs_bstat for every
|
|
|
|
* allocated inode, then pass the stat information to some externally provided
|
|
|
|
* iteration function.
|
2010-06-23 18:11:11 +10:00
|
|
|
*/
|
2019-07-02 09:39:40 -07:00
|
|
|
|
|
|
|
struct xfs_bstat_chunk {
|
|
|
|
bulkstat_one_fmt_pf formatter;
|
|
|
|
struct xfs_ibulk *breq;
|
|
|
|
struct xfs_bstat *buf;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fill out the bulkstat info for a single inode and report it somewhere.
|
|
|
|
*
|
|
|
|
* bc->breq->lastino is effectively the inode cursor as we walk through the
|
|
|
|
* filesystem. Therefore, we update it any time we need to move the cursor
|
|
|
|
* forward, regardless of whether or not we're sending any bstat information
|
|
|
|
* back to userspace. If the inode is internal metadata or, has been freed
|
|
|
|
* out from under us, we just simply keep going.
|
|
|
|
*
|
|
|
|
* However, if any other type of error happens we want to stop right where we
|
|
|
|
* are so that userspace will call back with exact number of the bad inode and
|
|
|
|
* we can send back an error code.
|
|
|
|
*
|
|
|
|
* Note that if the formatter tells us there's no space left in the buffer we
|
|
|
|
* move the cursor forward and abort the walk.
|
|
|
|
*/
|
|
|
|
STATIC int
|
2010-06-23 18:11:11 +10:00
|
|
|
xfs_bulkstat_one_int(
|
2019-07-02 09:39:40 -07:00
|
|
|
struct xfs_mount *mp,
|
|
|
|
struct xfs_trans *tp,
|
|
|
|
xfs_ino_t ino,
|
|
|
|
struct xfs_bstat_chunk *bc)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2010-06-23 18:11:11 +10:00
|
|
|
struct xfs_icdinode *dic; /* dinode core info pointer */
|
|
|
|
struct xfs_inode *ip; /* incore inode pointer */
|
2016-02-09 16:54:58 +11:00
|
|
|
struct inode *inode;
|
2019-07-02 09:39:40 -07:00
|
|
|
struct xfs_bstat *buf = bc->buf;
|
|
|
|
int error = -EINVAL;
|
2010-06-23 18:11:11 +10:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
if (xfs_internal_inum(mp, ino))
|
|
|
|
goto out_advance;
|
2010-06-23 18:11:11 +10:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
error = xfs_iget(mp, tp, ino,
|
2012-03-22 05:15:10 +00:00
|
|
|
(XFS_IGET_DONTCACHE | XFS_IGET_UNTRUSTED),
|
|
|
|
XFS_ILOCK_SHARED, &ip);
|
2019-07-02 09:39:40 -07:00
|
|
|
if (error == -ENOENT || error == -EINVAL)
|
|
|
|
goto out_advance;
|
2014-07-24 11:33:28 +10:00
|
|
|
if (error)
|
2019-07-02 09:39:40 -07:00
|
|
|
goto out;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
ASSERT(ip != NULL);
|
2008-11-28 14:23:41 +11:00
|
|
|
ASSERT(ip->i_imap.im_blkno != 0);
|
2016-02-09 16:54:58 +11:00
|
|
|
inode = VFS_I(ip);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
dic = &ip->i_d;
|
|
|
|
|
|
|
|
/* xfs_iget returns the following without needing
|
|
|
|
* further change.
|
|
|
|
*/
|
2010-09-26 06:10:18 +00:00
|
|
|
buf->bs_projid_lo = dic->di_projid_lo;
|
|
|
|
buf->bs_projid_hi = dic->di_projid_hi;
|
2005-04-16 15:20:36 -07:00
|
|
|
buf->bs_ino = ino;
|
|
|
|
buf->bs_uid = dic->di_uid;
|
|
|
|
buf->bs_gid = dic->di_gid;
|
|
|
|
buf->bs_size = dic->di_size;
|
2016-02-09 16:54:58 +11:00
|
|
|
|
2016-02-09 16:54:58 +11:00
|
|
|
buf->bs_nlink = inode->i_nlink;
|
2016-02-09 16:54:58 +11:00
|
|
|
buf->bs_atime.tv_sec = inode->i_atime.tv_sec;
|
|
|
|
buf->bs_atime.tv_nsec = inode->i_atime.tv_nsec;
|
|
|
|
buf->bs_mtime.tv_sec = inode->i_mtime.tv_sec;
|
|
|
|
buf->bs_mtime.tv_nsec = inode->i_mtime.tv_nsec;
|
|
|
|
buf->bs_ctime.tv_sec = inode->i_ctime.tv_sec;
|
|
|
|
buf->bs_ctime.tv_nsec = inode->i_ctime.tv_nsec;
|
2016-02-09 16:54:58 +11:00
|
|
|
buf->bs_gen = inode->i_generation;
|
2016-02-09 16:54:58 +11:00
|
|
|
buf->bs_mode = inode->i_mode;
|
2016-02-09 16:54:58 +11:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
buf->bs_xflags = xfs_ip2xflags(ip);
|
|
|
|
buf->bs_extsize = dic->di_extsize << mp->m_sb.sb_blocklog;
|
|
|
|
buf->bs_extents = dic->di_nextents;
|
|
|
|
memset(buf->bs_pad, 0, sizeof(buf->bs_pad));
|
2019-04-12 07:41:18 -07:00
|
|
|
xfs_bulkstat_health(ip, buf);
|
2005-04-16 15:20:36 -07:00
|
|
|
buf->bs_dmevmask = dic->di_dmevmask;
|
|
|
|
buf->bs_dmstate = dic->di_dmstate;
|
|
|
|
buf->bs_aextents = dic->di_anextents;
|
2010-03-05 04:41:14 +00:00
|
|
|
buf->bs_forkoff = XFS_IFORK_BOFF(ip);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2016-10-03 09:11:43 -07:00
|
|
|
if (dic->di_version == 3) {
|
|
|
|
if (dic->di_flags2 & XFS_DIFLAG2_COWEXTSIZE)
|
|
|
|
buf->bs_cowextsize = dic->di_cowextsize <<
|
|
|
|
mp->m_sb.sb_blocklog;
|
|
|
|
}
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
switch (dic->di_format) {
|
|
|
|
case XFS_DINODE_FMT_DEV:
|
2017-10-19 11:07:09 -07:00
|
|
|
buf->bs_rdev = sysv_encode_dev(inode->i_rdev);
|
2005-04-16 15:20:36 -07:00
|
|
|
buf->bs_blksize = BLKDEV_IOSIZE;
|
|
|
|
buf->bs_blocks = 0;
|
|
|
|
break;
|
|
|
|
case XFS_DINODE_FMT_LOCAL:
|
|
|
|
buf->bs_rdev = 0;
|
|
|
|
buf->bs_blksize = mp->m_sb.sb_blocksize;
|
|
|
|
buf->bs_blocks = 0;
|
|
|
|
break;
|
|
|
|
case XFS_DINODE_FMT_EXTENTS:
|
|
|
|
case XFS_DINODE_FMT_BTREE:
|
|
|
|
buf->bs_rdev = 0;
|
|
|
|
buf->bs_blksize = mp->m_sb.sb_blocksize;
|
|
|
|
buf->bs_blocks = dic->di_nblocks + ip->i_delayed_blks;
|
|
|
|
break;
|
|
|
|
}
|
2010-06-24 11:52:50 +10:00
|
|
|
xfs_iunlock(ip, XFS_ILOCK_SHARED);
|
2018-07-25 12:52:32 -07:00
|
|
|
xfs_irele(ip);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
error = bc->formatter(bc->breq, buf);
|
|
|
|
if (error == XFS_IBULK_ABORT)
|
|
|
|
goto out_advance;
|
|
|
|
if (error)
|
|
|
|
goto out;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
out_advance:
|
|
|
|
/*
|
|
|
|
* Advance the cursor to the inode that comes after the one we just
|
|
|
|
* looked at. We want the caller to move along if the bulkstat
|
|
|
|
* information was copied successfully; if we tried to grab the inode
|
|
|
|
* but it's no longer allocated; or if it's internal metadata.
|
|
|
|
*/
|
|
|
|
bc->breq->startino = ino + 1;
|
|
|
|
out:
|
2010-06-23 18:11:11 +10:00
|
|
|
return error;
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
/* Bulkstat a single inode. */
|
2008-11-25 21:20:11 -06:00
|
|
|
int
|
|
|
|
xfs_bulkstat_one(
|
2019-07-02 09:39:40 -07:00
|
|
|
struct xfs_ibulk *breq,
|
|
|
|
bulkstat_one_fmt_pf formatter)
|
2008-11-25 21:20:11 -06:00
|
|
|
{
|
2019-07-02 09:39:40 -07:00
|
|
|
struct xfs_bstat_chunk bc = {
|
|
|
|
.formatter = formatter,
|
|
|
|
.breq = breq,
|
|
|
|
};
|
|
|
|
int error;
|
|
|
|
|
|
|
|
ASSERT(breq->icount == 1);
|
|
|
|
|
|
|
|
bc.buf = kmem_zalloc(sizeof(struct xfs_bstat), KM_SLEEP | KM_MAYFAIL);
|
|
|
|
if (!bc.buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
error = xfs_bulkstat_one_int(breq->mp, NULL, breq->startino, &bc);
|
|
|
|
|
|
|
|
kmem_free(bc.buf);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we reported one inode to userspace then we abort because we hit
|
|
|
|
* the end of the buffer. Don't leak that back to userspace.
|
|
|
|
*/
|
|
|
|
if (error == XFS_IWALK_ABORT)
|
|
|
|
error = 0;
|
|
|
|
|
|
|
|
return error;
|
2006-09-28 11:01:46 +10:00
|
|
|
}
|
|
|
|
|
2014-11-07 08:30:30 +11:00
|
|
|
static int
|
2019-07-02 09:39:40 -07:00
|
|
|
xfs_bulkstat_iwalk(
|
|
|
|
struct xfs_mount *mp,
|
|
|
|
struct xfs_trans *tp,
|
|
|
|
xfs_ino_t ino,
|
|
|
|
void *data)
|
2014-08-04 11:22:31 +10:00
|
|
|
{
|
2019-07-02 09:39:40 -07:00
|
|
|
int error;
|
2014-11-07 08:33:52 +11:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
error = xfs_bulkstat_one_int(mp, tp, ino, data);
|
|
|
|
/* bulkstat just skips over missing inodes */
|
|
|
|
if (error == -ENOENT || error == -EINVAL)
|
|
|
|
return 0;
|
2014-08-04 11:22:31 +10:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/*
|
2019-07-02 09:39:40 -07:00
|
|
|
* Check the incoming lastino parameter.
|
|
|
|
*
|
|
|
|
* We allow any inode value that could map to physical space inside the
|
|
|
|
* filesystem because if there are no inodes there, bulkstat moves on to the
|
|
|
|
* next chunk. In other words, the magic agino value of zero takes us to the
|
|
|
|
* first chunk in the AG, and an agino value past the end of the AG takes us to
|
|
|
|
* the first chunk in the next AG.
|
|
|
|
*
|
|
|
|
* Therefore we can end early if the requested inode is beyond the end of the
|
|
|
|
* filesystem or doesn't map properly.
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
2019-07-02 09:39:40 -07:00
|
|
|
static inline bool
|
|
|
|
xfs_bulkstat_already_done(
|
|
|
|
struct xfs_mount *mp,
|
|
|
|
xfs_ino_t startino)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2019-07-02 09:39:40 -07:00
|
|
|
xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, startino);
|
|
|
|
xfs_agino_t agino = XFS_INO_TO_AGINO(mp, startino);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
return agno >= mp->m_sb.sb_agcount ||
|
|
|
|
startino != XFS_AGINO_TO_INO(mp, agno, agino);
|
|
|
|
}
|
2014-07-24 18:40:26 +10:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
/* Return stat information in bulk (by-inode) for the filesystem. */
|
|
|
|
int
|
|
|
|
xfs_bulkstat(
|
|
|
|
struct xfs_ibulk *breq,
|
|
|
|
bulkstat_one_fmt_pf formatter)
|
|
|
|
{
|
|
|
|
struct xfs_bstat_chunk bc = {
|
|
|
|
.formatter = formatter,
|
|
|
|
.breq = breq,
|
|
|
|
};
|
|
|
|
int error;
|
2014-11-07 08:30:30 +11:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
if (xfs_bulkstat_already_done(breq->mp, breq->startino))
|
|
|
|
return 0;
|
2014-11-07 08:30:30 +11:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
bc.buf = kmem_zalloc(sizeof(struct xfs_bstat), KM_SLEEP | KM_MAYFAIL);
|
|
|
|
if (!bc.buf)
|
2014-06-25 14:58:08 +10:00
|
|
|
return -ENOMEM;
|
2014-11-07 08:30:30 +11:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
error = xfs_iwalk(breq->mp, NULL, breq->startino, xfs_bulkstat_iwalk,
|
|
|
|
breq->icount, &bc);
|
2014-11-07 08:31:13 +11:00
|
|
|
|
2019-07-02 09:39:40 -07:00
|
|
|
kmem_free(bc.buf);
|
2014-11-07 08:31:15 +11:00
|
|
|
|
2007-11-23 16:30:32 +11:00
|
|
|
/*
|
2014-11-07 08:31:15 +11:00
|
|
|
* We found some inodes, so clear the error status and return them.
|
|
|
|
* The lastino pointer will point directly at the inode that triggered
|
|
|
|
* any error that occurred, so on the next call the error will be
|
|
|
|
* triggered again and propagated to userspace as there will be no
|
|
|
|
* formatted inodes in the buffer.
|
2007-11-23 16:30:32 +11:00
|
|
|
*/
|
2019-07-02 09:39:40 -07:00
|
|
|
if (breq->ocount > 0)
|
2014-11-07 08:31:15 +11:00
|
|
|
error = 0;
|
|
|
|
|
|
|
|
return error;
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
2007-07-11 11:10:19 +10:00
|
|
|
int
|
|
|
|
xfs_inumbers_fmt(
|
|
|
|
void __user *ubuffer, /* buffer to write to */
|
2014-07-24 12:11:47 +10:00
|
|
|
const struct xfs_inogrp *buffer, /* buffer to read from */
|
2007-07-11 11:10:19 +10:00
|
|
|
long count, /* # of elements to read */
|
|
|
|
long *written) /* # of bytes written */
|
|
|
|
{
|
|
|
|
if (copy_to_user(ubuffer, buffer, count * sizeof(*buffer)))
|
|
|
|
return -EFAULT;
|
|
|
|
*written = count * sizeof(*buffer);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/*
|
|
|
|
* Return inode number table for the filesystem.
|
|
|
|
*/
|
|
|
|
int /* error status */
|
|
|
|
xfs_inumbers(
|
2014-07-24 12:11:47 +10:00
|
|
|
struct xfs_mount *mp,/* mount point for filesystem */
|
|
|
|
xfs_ino_t *lastino,/* last inode returned */
|
|
|
|
int *count,/* size of buffer/count returned */
|
|
|
|
void __user *ubuffer,/* buffer with inode descriptions */
|
|
|
|
inumbers_fmt_pf formatter)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2014-07-24 12:11:47 +10:00
|
|
|
xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, *lastino);
|
|
|
|
xfs_agino_t agino = XFS_INO_TO_AGINO(mp, *lastino);
|
|
|
|
struct xfs_btree_cur *cur = NULL;
|
2014-07-24 12:18:47 +10:00
|
|
|
struct xfs_buf *agbp = NULL;
|
2014-07-24 12:11:47 +10:00
|
|
|
struct xfs_inogrp *buffer;
|
|
|
|
int bcount;
|
|
|
|
int left = *count;
|
|
|
|
int bufidx = 0;
|
|
|
|
int error = 0;
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
*count = 0;
|
2014-07-24 12:11:47 +10:00
|
|
|
if (agno >= mp->m_sb.sb_agcount ||
|
|
|
|
*lastino != XFS_AGINO_TO_INO(mp, agno, agino))
|
|
|
|
return error;
|
|
|
|
|
2018-06-07 07:54:02 -07:00
|
|
|
bcount = min(left, (int)(PAGE_SIZE / sizeof(*buffer)));
|
2017-04-03 12:22:39 -07:00
|
|
|
buffer = kmem_zalloc(bcount * sizeof(*buffer), KM_SLEEP);
|
2014-07-24 12:18:47 +10:00
|
|
|
do {
|
2014-07-24 12:11:47 +10:00
|
|
|
struct xfs_inobt_rec_incore r;
|
|
|
|
int stat;
|
|
|
|
|
2014-07-24 12:18:47 +10:00
|
|
|
if (!agbp) {
|
2005-04-16 15:20:36 -07:00
|
|
|
error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp);
|
2014-07-24 12:18:47 +10:00
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
|
2014-04-24 16:00:50 +10:00
|
|
|
cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno,
|
|
|
|
XFS_BTNUM_INO);
|
2009-08-31 20:58:21 -03:00
|
|
|
error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_GE,
|
2014-07-24 12:11:47 +10:00
|
|
|
&stat);
|
2014-07-24 12:18:47 +10:00
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
if (!stat)
|
|
|
|
goto next_ag;
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
2014-07-24 12:18:47 +10:00
|
|
|
|
2014-07-24 12:11:47 +10:00
|
|
|
error = xfs_inobt_get_rec(cur, &r, &stat);
|
2014-07-24 12:18:47 +10:00
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
if (!stat)
|
|
|
|
goto next_ag;
|
|
|
|
|
2009-08-31 20:56:58 -03:00
|
|
|
agino = r.ir_startino + XFS_INODES_PER_CHUNK - 1;
|
|
|
|
buffer[bufidx].xi_startino =
|
|
|
|
XFS_AGINO_TO_INO(mp, agno, r.ir_startino);
|
2015-05-29 09:04:19 +10:00
|
|
|
buffer[bufidx].xi_alloccount = r.ir_count - r.ir_freecount;
|
2009-08-31 20:56:58 -03:00
|
|
|
buffer[bufidx].xi_allocmask = ~r.ir_free;
|
2014-07-24 12:18:47 +10:00
|
|
|
if (++bufidx == bcount) {
|
|
|
|
long written;
|
|
|
|
|
2014-07-24 12:11:47 +10:00
|
|
|
error = formatter(ubuffer, buffer, bufidx, &written);
|
|
|
|
if (error)
|
2005-04-16 15:20:36 -07:00
|
|
|
break;
|
2007-07-11 11:10:19 +10:00
|
|
|
ubuffer += written;
|
2005-04-16 15:20:36 -07:00
|
|
|
*count += bufidx;
|
|
|
|
bufidx = 0;
|
|
|
|
}
|
2014-07-24 12:18:47 +10:00
|
|
|
if (!--left)
|
|
|
|
break;
|
|
|
|
|
|
|
|
error = xfs_btree_increment(cur, 0, &stat);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
if (stat)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
next_ag:
|
|
|
|
xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
|
|
|
|
cur = NULL;
|
|
|
|
xfs_buf_relse(agbp);
|
|
|
|
agbp = NULL;
|
|
|
|
agino = 0;
|
2014-10-13 10:21:53 +11:00
|
|
|
agno++;
|
|
|
|
} while (agno < mp->m_sb.sb_agcount);
|
2014-07-24 12:18:47 +10:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
if (!error) {
|
|
|
|
if (bufidx) {
|
2014-07-24 12:18:47 +10:00
|
|
|
long written;
|
|
|
|
|
2014-07-24 12:11:47 +10:00
|
|
|
error = formatter(ubuffer, buffer, bufidx, &written);
|
|
|
|
if (!error)
|
2005-04-16 15:20:36 -07:00
|
|
|
*count += bufidx;
|
|
|
|
}
|
|
|
|
*lastino = XFS_AGINO_TO_INO(mp, agno, agino);
|
|
|
|
}
|
2014-07-24 12:18:47 +10:00
|
|
|
|
2008-05-19 16:31:57 +10:00
|
|
|
kmem_free(buffer);
|
2005-04-16 15:20:36 -07:00
|
|
|
if (cur)
|
2018-07-19 12:26:31 -07:00
|
|
|
xfs_btree_del_cursor(cur, error);
|
2005-04-16 15:20:36 -07:00
|
|
|
if (agbp)
|
|
|
|
xfs_buf_relse(agbp);
|
2014-07-24 12:18:47 +10:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
return error;
|
|
|
|
}
|