Inode Scanning

The inode module provides methods for performing inode scans and for determining properties of inodes.

Also refer to the arcapix.fs.gpfs.clib.utils.inode_iterator convenience function.

Note

These objects require root permission to create

Description

iattr struct

The iattr struct, returned by next_inode() and stat_inode(), has the following fields

ia_mode              # access mode
ia_uid               # owner uid
ia_gid               # owner gid
ia_inode             # file inode number
ia_gen               # inode generation number
ia_nlink             # number of links
ia_size              # file size in bytes
ia_blocks            # 512 byte blocks of disk held by file
ia_atime             # time of last access
ia_winflags          # windows flags - can be converted with 'get_winflags_strings'
ia_mtime             # time of last data modification
ia_flags             # flags - can be converted with 'get_flags_strings'
ia_repl_data         # data replication factor
ia_repl_data_max     # data replication max factor
ia_repl_meta         # meta data replication factor
ia_repl_meta_max     # meta data replication max factor
ia_ctime             # time of last status change
ia_blocksize         # preferred block size for io
ia_createtime        # creation time
ia_xperm             # extended attributes - can be converted with 'get_xperms_strings'
ia_dev               # id of device containing file
ia_rdev              # device id (if special file)
ia_pcacheflags       # pcache inode bits - can be converted with 'get_pcacheflags_strings'
ia_modsnapid         # snapshot id of last modification
ia_filesetid         # fileset ID - can be converted to name with 'igetfilesetname'
ia_datapoolid        # storage pool ID for data - can be converted to name with 'igetstoragepool'
ia_inode_space_mask  # inode space mask of this file system
                     # This value is saved in the iattr structure
                     #    during backup and used during restore

Time fields ia_atime, ia_mtime, ia_ctime, and ia_changetime are type float. All other fields are of type int.

Examples

List attributes for all inodes in a Filesystem

>>> from arcapix.fs.gpfs.clib.inode import open_inodescan, next_inode, close_inodescan
>>> from arcapix.fs.gpfs.clib.fssnap import get_fssnaphandle_by_name
>>>
>>> # get fssnap_handle for filesystem 'mmfs1'
... fs = get_fssnaphandle_by_name('mmfs1')
>>>
>>> # open an inodescan
... iscan = open_inodescan(fs)
>>>
>>> # iterate over inodes
... for i in iter(lambda: next_inode(iscan), None):
...     # print formatted results
...     print "%010d/%010d\t%010u\t%010u\n" % (i.ia_inode, i.ia_gen, i.ia_mtime, i.ia_ctime)
'0000000003/0000000001   1462870041  1462870041'
'0000000042/0000065538   1464784185  1448989426'
'0000000043/0000065538   1464784185  1448989427'
'0000000044/0000065538   1464784185  1448989427'
'0000004038/0779965892   1459948505  1459948505'
'...'

>>> # remember to close iscan
... close_inodescan(iscan)