# ioctl_xfs_fsbulkstat

## NAME



           ioctl_xfs_fsbulkstat - query information for a batch of XFS inodes
    


## SYNOPSIS



           **#include <xfs/xfs_fs.h>**
    
           **int ioctl(int** _fd_**, XFS_IOC_FSBULKSTAT, struct xfs_fsop_bulkreq**
           *****_arg_**);**
           **int ioctl(int** _fd_**, XFS_IOC_FSBULKSTAT_SINGLE, struct**
           **xfs_fsop_bulkreq ***_arg_**);**
    


## DESCRIPTION



           Query stat information for a group of XFS inodes.
    
           NOTE: This ioctl has been superseded.  Please see the
           ioctl_xfs_bulkstat(2) manpage for information about its
           replacement.
    
           These ioctls use **struct xfs_fsop_bulkreq** to set up a bulk transfer
           with the kernel:
    
               struct xfs_fsop_bulkreq {
                    __u64             *lastip;
                    __s32             count;
                    void              *ubuffer;
                    __s32             *ocount;
               };
    
           _lastip_ points to a value that will receive the number of the "last
           inode."  This cannot be NULL.  For **FSBULKSTAT** , this should be set
           to one less than the number of the first inode for which the
           caller wants information, or zero to start with the first inode in
           the filesystem.  For **FSBULKSTAT_SINGLE** , this should be set to the
           number of the inode for which the caller wants information.  After
           the call, this value will be set to the number of the last inode
           for which information was supplied.  This field will not be
           updated if _ocount_ is NULL.
    
           _count_ is the number of elements in the **ubuffer** array and therefore
           the number of inodes for which to return stat information.  This
           value must be set to 1 for **FSBULKSTAT_SINGLE**.
    
           _ocount_ points to a value that will receive the number of records
           returned.  If this value is NULL, then neither _ocount_ nor _lastip_
           will be updated.
    
           _ubuffer_ points to a memory buffer into which inode stat
           information will be copied.  This buffer must be an array of
           **struct xfs_bstat** which is described below.  The array must have at
           least _count_ elements.
    
               struct xfs_bstat {
                    __u64             bs_ino;
                    __u16             bs_mode;
                    __u16             bs_nlink;
                    __u32             bs_uid;
                    __u32             bs_gid;
                    __u32             bs_rdev;
                    __s32             bs_blksize;
                    __s64             bs_size;
                    struct xfs_bstime bs_atime;
                    struct xfs_bstime bs_mtime;
                    struct xfs_bstime bs_ctime;
                    int64_t           bs_blocks;
                    __u32             bs_xflags;
                    __s32             bs_extsize;
                    __s32             bs_extents;
                    __u32             bs_gen;
                    __u16             bs_projid_lo;
                    __u16             bs_forkoff;
                    __u16             bs_projid_hi;
                    uint16_t          bs_sick;
                    uint16_t          bs_checked;
                    unsigned char     bs_pad[2];
                    __u32             bs_cowextsize;
                    __u32             bs_dmevmask;
                    __u16             bs_dmstate;
                    __u16             bs_aextents;
               };
    
           The structure members are as follows:
    
           _bs_ino_ is the inode number for this record.
    
           _bs_mode_ is the file type and mode.
    
           _bs_nlink_ is the number of hard links to this inode.
    
           _bs_uid_ is the user id.
    
           _bs_gid_ is the group id.
    
           _bs_rdev_ is the encoded device id if this is a special file.
    
           _bs_blksize_ is the size of a data block for this file, in units of
           bytes.
    
           _bs_size_ is the size of the file, in bytes.
    
           _bs_atime_ is the last time this file was accessed.
    
           _bs_mtime_ is the last time the contents of this file were modified.
    
           _bs_ctime_ is the last time this inode record was modified.
    
           _bs_blocks_ is the number of filesystem blocks allocated to this
           file, including metadata.
    
           _bs_xflags_ contains the extended flags that are set on this inode.
           These flags are the same values as those defined in the **XFS INODE**
           **FLAGS** section of the ioctl_xfs_fsgetxattr(2) manpage.
    
           _bs_extsize_ is the extent size hint for this file, in bytes.
    
           _bs_extents_ is the number of storage mappings associated with this
           file's data.
    
           _bs_gen_ is the generation number of the inode record.
    
           _bs_projid_lo_ is the lower 16-bits of the project id.
    
           _bs_forkoff_ is the offset of the attribute fork in the inode
           record, in bytes.
    
           _bs_projid_hi_ is the upper 16-bits of the project id.
    
           _bs_pad[6]_ is zeroed.
    
           _bs_cowextsize_ is the Copy on Write extent size hint for this file,
           in bytes.
    
           _bs_dmevmask_ is unused on Linux.
    
           _bs_dmstate_ is unused on Linux.
    
           _bs_aextents_ is the number of storage mappings associated with this
           file's extended attributes.
    
           The fields _bs_sick_ and _bs_checked_ indicate the relative health of
           various inode metadata:
    
           • If a given sick flag is set in _bs_sick_ , then that piece of
             metadata has been observed to be damaged.  The same bit should
             be set in _bs_checked_.
    
           • If a given sick flag is set in _bs_checked_ but is not set in
             _bs_sick_ , then that piece of metadata has been checked and is not
             faulty.
    
           • If a given sick flag is not set in _bs_checked_ , then no
             conclusion can be made.
    
           The following flags apply to these fields:
    
               **XFS_BS_SICK_INODE**
                      The inode's record itself.
    
               **XFS_BS_SICK_BMBTD**
                      File data extent mappings.
    
               **XFS_BS_SICK_BMBTA**
                      Extended attribute extent mappings.
    
               **XFS_BS_SICK_BMBTC**
                      Copy on Write staging extent mappings.
    
               **XFS_BS_SICK_DIR**
                      Directory information.
    
               **XFS_BS_SICK_XATTR**
                      Extended attribute data.
    
               **XFS_BS_SICK_SYMLINK**
                      Symbolic link target.
    
               **XFS_BS_SICK_PARENT**
                      Parent pointers.
    
               **XFS_BS_SICK_DIRTREE**
                      Directory is the source of corruption in the directory
                      tree.
    


## RETURN VALUE



           On error, -1 is returned, and _errno_ is set to indicate the error.
    


## ERRORS



           Error codes can be one of, but are not limited to, the following:
    
           **EFAULT** The kernel was not able to copy into the userspace buffer.
    
           **EFSBADCRC**
                  Metadata checksum validation failed while performing the
                  query.
    
           **EFSCORRUPTED**
                  Metadata corruption was encountered while performing the
                  query.
    
           **EINVAL** One of the arguments was not valid.
    
           **EIO** An I/O error was encountered while performing the query.
    
           **ENOMEM** There was insufficient memory to perform the query.
    


## CONFORMING TO



           This API is specific to XFS filesystem on the Linux kernel.
    


* * *