Lines Matching +full:detect +full:- +full:us

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
42 * bc->breq->lastino is effectively the inode cursor as we walk through the
46 * out from under us, we just simply keep going.
52 * Note that if the formatter tells us there's no space left in the buffer we
63 struct user_namespace *sb_userns = mp->m_super->s_user_ns; in xfs_bulkstat_one_int()
66 struct xfs_bulkstat *buf = bc->buf; in xfs_bulkstat_one_int()
68 int error = -EINVAL; in xfs_bulkstat_one_int()
78 if (error == -ENOENT || error == -EINVAL) in xfs_bulkstat_one_int()
95 ASSERT(ip->i_imap.im_blkno != 0); in xfs_bulkstat_one_int()
103 buf->bs_projectid = ip->i_projid; in xfs_bulkstat_one_int()
104 buf->bs_ino = ino; in xfs_bulkstat_one_int()
105 buf->bs_uid = from_kuid(sb_userns, vfsuid_into_kuid(vfsuid)); in xfs_bulkstat_one_int()
106 buf->bs_gid = from_kgid(sb_userns, vfsgid_into_kgid(vfsgid)); in xfs_bulkstat_one_int()
107 buf->bs_size = ip->i_disk_size; in xfs_bulkstat_one_int()
109 buf->bs_nlink = inode->i_nlink; in xfs_bulkstat_one_int()
110 buf->bs_atime = inode->i_atime.tv_sec; in xfs_bulkstat_one_int()
111 buf->bs_atime_nsec = inode->i_atime.tv_nsec; in xfs_bulkstat_one_int()
112 buf->bs_mtime = inode->i_mtime.tv_sec; in xfs_bulkstat_one_int()
113 buf->bs_mtime_nsec = inode->i_mtime.tv_nsec; in xfs_bulkstat_one_int()
114 buf->bs_ctime = inode_get_ctime(inode).tv_sec; in xfs_bulkstat_one_int()
115 buf->bs_ctime_nsec = inode_get_ctime(inode).tv_nsec; in xfs_bulkstat_one_int()
116 buf->bs_gen = inode->i_generation; in xfs_bulkstat_one_int()
117 buf->bs_mode = inode->i_mode; in xfs_bulkstat_one_int()
119 buf->bs_xflags = xfs_ip2xflags(ip); in xfs_bulkstat_one_int()
120 buf->bs_extsize_blks = ip->i_extsize; in xfs_bulkstat_one_int()
122 nextents = xfs_ifork_nextents(&ip->i_df); in xfs_bulkstat_one_int()
123 if (!(bc->breq->flags & XFS_IBULK_NREXT64)) in xfs_bulkstat_one_int()
124 buf->bs_extents = min(nextents, XFS_MAX_EXTCNT_DATA_FORK_SMALL); in xfs_bulkstat_one_int()
126 buf->bs_extents64 = nextents; in xfs_bulkstat_one_int()
129 buf->bs_aextents = xfs_ifork_nextents(&ip->i_af); in xfs_bulkstat_one_int()
130 buf->bs_forkoff = xfs_inode_fork_boff(ip); in xfs_bulkstat_one_int()
131 buf->bs_version = XFS_BULKSTAT_VERSION_V5; in xfs_bulkstat_one_int()
134 buf->bs_btime = ip->i_crtime.tv_sec; in xfs_bulkstat_one_int()
135 buf->bs_btime_nsec = ip->i_crtime.tv_nsec; in xfs_bulkstat_one_int()
136 if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) in xfs_bulkstat_one_int()
137 buf->bs_cowextsize_blks = ip->i_cowextsize; in xfs_bulkstat_one_int()
140 switch (ip->i_df.if_format) { in xfs_bulkstat_one_int()
142 buf->bs_rdev = sysv_encode_dev(inode->i_rdev); in xfs_bulkstat_one_int()
143 buf->bs_blksize = BLKDEV_IOSIZE; in xfs_bulkstat_one_int()
144 buf->bs_blocks = 0; in xfs_bulkstat_one_int()
147 buf->bs_rdev = 0; in xfs_bulkstat_one_int()
148 buf->bs_blksize = mp->m_sb.sb_blocksize; in xfs_bulkstat_one_int()
149 buf->bs_blocks = 0; in xfs_bulkstat_one_int()
153 buf->bs_rdev = 0; in xfs_bulkstat_one_int()
154 buf->bs_blksize = mp->m_sb.sb_blocksize; in xfs_bulkstat_one_int()
155 buf->bs_blocks = ip->i_nblocks + ip->i_delayed_blks; in xfs_bulkstat_one_int()
161 error = bc->formatter(bc->breq, buf); in xfs_bulkstat_one_int()
162 if (error == -ECANCELED) in xfs_bulkstat_one_int()
174 bc->breq->startino = ino + 1; in xfs_bulkstat_one_int()
192 if (breq->idmap != &nop_mnt_idmap) { in xfs_bulkstat_one()
193 xfs_warn_ratelimited(breq->mp, in xfs_bulkstat_one()
195 return -EINVAL; in xfs_bulkstat_one()
198 ASSERT(breq->icount == 1); in xfs_bulkstat_one()
203 return -ENOMEM; in xfs_bulkstat_one()
207 * locking abilities to detect cycles in the inobt without deadlocking. in xfs_bulkstat_one()
209 error = xfs_trans_alloc_empty(breq->mp, &tp); in xfs_bulkstat_one()
213 error = xfs_bulkstat_one_int(breq->mp, breq->idmap, tp, in xfs_bulkstat_one()
214 breq->startino, &bc); in xfs_bulkstat_one()
223 if (error == -ECANCELED) in xfs_bulkstat_one()
239 error = xfs_bulkstat_one_int(mp, bc->breq->idmap, tp, ino, data); in xfs_bulkstat_iwalk()
241 if (error == -ENOENT || error == -EINVAL) in xfs_bulkstat_iwalk()
251 * next chunk. In other words, the magic agino value of zero takes us to the
252 * first chunk in the AG, and an agino value past the end of the AG takes us to
266 return agno >= mp->m_sb.sb_agcount || in xfs_bulkstat_already_done()
270 /* Return stat information in bulk (by-inode) for the filesystem. */
284 if (breq->idmap != &nop_mnt_idmap) { in xfs_bulkstat()
285 xfs_warn_ratelimited(breq->mp, in xfs_bulkstat()
287 return -EINVAL; in xfs_bulkstat()
289 if (xfs_bulkstat_already_done(breq->mp, breq->startino)) in xfs_bulkstat()
295 return -ENOMEM; in xfs_bulkstat()
299 * locking abilities to detect cycles in the inobt without deadlocking. in xfs_bulkstat()
301 error = xfs_trans_alloc_empty(breq->mp, &tp); in xfs_bulkstat()
305 if (breq->flags & XFS_IBULK_SAME_AG) in xfs_bulkstat()
308 error = xfs_iwalk(breq->mp, tp, breq->startino, iwalk_flags, in xfs_bulkstat()
309 xfs_bulkstat_iwalk, breq->icount, &bc); in xfs_bulkstat()
321 if (breq->ocount > 0) in xfs_bulkstat()
336 bs1->bs_ino = bstat->bs_ino; in xfs_bulkstat_to_bstat()
337 bs1->bs_mode = bstat->bs_mode; in xfs_bulkstat_to_bstat()
338 bs1->bs_nlink = bstat->bs_nlink; in xfs_bulkstat_to_bstat()
339 bs1->bs_uid = bstat->bs_uid; in xfs_bulkstat_to_bstat()
340 bs1->bs_gid = bstat->bs_gid; in xfs_bulkstat_to_bstat()
341 bs1->bs_rdev = bstat->bs_rdev; in xfs_bulkstat_to_bstat()
342 bs1->bs_blksize = bstat->bs_blksize; in xfs_bulkstat_to_bstat()
343 bs1->bs_size = bstat->bs_size; in xfs_bulkstat_to_bstat()
344 bs1->bs_atime.tv_sec = bstat->bs_atime; in xfs_bulkstat_to_bstat()
345 bs1->bs_mtime.tv_sec = bstat->bs_mtime; in xfs_bulkstat_to_bstat()
346 bs1->bs_ctime.tv_sec = bstat->bs_ctime; in xfs_bulkstat_to_bstat()
347 bs1->bs_atime.tv_nsec = bstat->bs_atime_nsec; in xfs_bulkstat_to_bstat()
348 bs1->bs_mtime.tv_nsec = bstat->bs_mtime_nsec; in xfs_bulkstat_to_bstat()
349 bs1->bs_ctime.tv_nsec = bstat->bs_ctime_nsec; in xfs_bulkstat_to_bstat()
350 bs1->bs_blocks = bstat->bs_blocks; in xfs_bulkstat_to_bstat()
351 bs1->bs_xflags = bstat->bs_xflags; in xfs_bulkstat_to_bstat()
352 bs1->bs_extsize = XFS_FSB_TO_B(mp, bstat->bs_extsize_blks); in xfs_bulkstat_to_bstat()
353 bs1->bs_extents = bstat->bs_extents; in xfs_bulkstat_to_bstat()
354 bs1->bs_gen = bstat->bs_gen; in xfs_bulkstat_to_bstat()
355 bs1->bs_projid_lo = bstat->bs_projectid & 0xFFFF; in xfs_bulkstat_to_bstat()
356 bs1->bs_forkoff = bstat->bs_forkoff; in xfs_bulkstat_to_bstat()
357 bs1->bs_projid_hi = bstat->bs_projectid >> 16; in xfs_bulkstat_to_bstat()
358 bs1->bs_sick = bstat->bs_sick; in xfs_bulkstat_to_bstat()
359 bs1->bs_checked = bstat->bs_checked; in xfs_bulkstat_to_bstat()
360 bs1->bs_cowextsize = XFS_FSB_TO_B(mp, bstat->bs_cowextsize_blks); in xfs_bulkstat_to_bstat()
361 bs1->bs_dmevmask = 0; in xfs_bulkstat_to_bstat()
362 bs1->bs_dmstate = 0; in xfs_bulkstat_to_bstat()
363 bs1->bs_aextents = bstat->bs_aextents; in xfs_bulkstat_to_bstat()
383 * error. If the formatter tells us the buffer is now full we also move the
395 .xi_startino = XFS_AGINO_TO_INO(mp, agno, irec->ir_startino), in xfs_inumbers_walk()
396 .xi_alloccount = irec->ir_count - irec->ir_freecount, in xfs_inumbers_walk()
397 .xi_allocmask = ~irec->ir_free, in xfs_inumbers_walk()
403 error = ic->formatter(ic->breq, &inogrp); in xfs_inumbers_walk()
404 if (error && error != -ECANCELED) in xfs_inumbers_walk()
407 ic->breq->startino = XFS_AGINO_TO_INO(mp, agno, irec->ir_startino) + in xfs_inumbers_walk()
427 if (xfs_bulkstat_already_done(breq->mp, breq->startino)) in xfs_inumbers()
432 * locking abilities to detect cycles in the inobt without deadlocking. in xfs_inumbers()
434 error = xfs_trans_alloc_empty(breq->mp, &tp); in xfs_inumbers()
438 error = xfs_inobt_walk(breq->mp, tp, breq->startino, breq->flags, in xfs_inumbers()
439 xfs_inumbers_walk, breq->icount, &ic); in xfs_inumbers()
450 if (breq->ocount > 0) in xfs_inumbers()
464 ig1->xi_startino = ig->xi_startino; in xfs_inumbers_to_inogrp()
465 ig1->xi_alloccount = ig->xi_alloccount; in xfs_inumbers_to_inogrp()
466 ig1->xi_allocmask = ig->xi_allocmask; in xfs_inumbers_to_inogrp()