summaryrefslogtreecommitdiff
path: root/fs
AgeCommit message (Collapse)Author
2019-10-09xfs: enable metadata inode directory featuremetadir_2019-10-09Darrick J. Wong
Enable the metadata inode directory feature. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: scrub and repair finobt block countersDarrick J. Wong
Check and repair the free inode btree block counters in the AGI. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: store free inode btree block counts in AGI headerDarrick J. Wong
Add a free inode btree block usage counter to the AGI header so that we don't have to walk the entire finobt at mount time to create the per-AG reservations. We piggyback on the metadir feature bit to avoid burning extra incompat bits. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: disable the agi rotor for metadata inodesDarrick J. Wong
Ideally, we'd put all the metadata inodes in one place if we could, so that the metadata all stay reasonably close together instead of spreading out over the disk. Furthermore, if the log is internal we'd probably prefer to keep the metadata near the log. Therefore, disable AGI rotoring for metadata inode allocations. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: ensure metadata directory paths exist before creating filesDarrick J. Wong
Since xfs_imeta_create can create new metadata files arbitrarily deep in the metadata directory tree, we must supply a function that can ensure that all directories in a path exist, and call it before the quota functions create the quota inodes. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: read and write metadata inode directoryDarrick J. Wong
Plumb in the bits we need to look up metadata inode numbers from the metadata inode directory and save them back. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: enforce metadata inode flagDarrick J. Wong
Add checks for the metadata inode flag so that we don't ever leak metadata inodes out to userspace, and we don't ever try to read a regular inode as metadata. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: convert metadata inode lookup keys to use pathsDarrick J. Wong
Convert the magic metadata inode lookup keys to use actual strings for paths. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: load metadata inode directory at mount timeDarrick J. Wong
Load the metadata directory inode into memory at mount time and release it at unmount time. We also make sure that the obsolete inode pointers in the superblock are not logged or read from the superblock. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: define the on-disk format for the metadir featureDarrick J. Wong
Define the on-disk layout and feature flags for the metadata inode directory feature. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: iget for metadata inodesDarrick J. Wong
Create a xfs_iget_meta function for metadata inodes to ensure that we always check that the inobt thinks a metadata inode is in use. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: convert all users to xfs_imeta_logDarrick J. Wong
Convert all open-coded sb metadata inode pointer logging to use xfs_imeta_log. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: refactor the v4 group/project inode pointer switchDarrick J. Wong
Refactor the group and project quota inode pointer switcheroo that happens only on v4 filesystems into a separate function prior to enhancing the xfs_qm_qino_alloc function. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: create transaction reservations for metadata inode operationsDarrick J. Wong
Create transaction reservation types and block reservation helpers to help us calculate transaction requirements. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: create imeta abstractions to get and set metadata inodesDarrick J. Wong
Create some helper routines to get and set metadata inode numbers instead of open-coding them throughout xfs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: get rid of cross_renameinode-refactor_2019-10-09Darrick J. Wong
Get rid of the largely pointless xfs_cross_rename now that we've refactored its parent. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: create libxfs helper to rename two directory entriesDarrick J. Wong
Create a new libxfs function to rename two directory entries. The upcoming metadata directory feature will need this to replace a metadata inode directory entry. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: create libxfs helper to exchange two directory entriesDarrick J. Wong
Create a new libxfs function to exchange two directory entries. The upcoming metadata directory feature will need this to replace a metadata inode directory entry. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: create libxfs helper to remove an existing inode/name from a directoryDarrick J. Wong
Create a new libxfs function to remove a (name, inode) entry from a directory. The upcoming metadata directory feature will need this to create a metadata directory tree. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: hoist inode free function to libxfsDarrick J. Wong
Create a libxfs helper function that marks an inode free on disk. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: create libxfs helper to link an existing inode into a directoryDarrick J. Wong
Create a new libxfs function to link an existing inode into a directory. The upcoming metadata directory feature will need this to create a metadata directory tree. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: create libxfs helper to link a new inode into a directoryDarrick J. Wong
Create a new libxfs function to link a newly created inode into a directory. The upcoming metadata directory feature will need this to create a metadata directory tree. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: hoist xfs_{bump,drop}link to libxfsDarrick J. Wong
Move xfs_bumplink and xfs_droplink to libxfs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: hoist xfs_iunlink to libxfsDarrick J. Wong
Move xfs_iunlink and xfs_iunlink_remove to libxfs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: move xfs_dir_ialloc to libxfsDarrick J. Wong
Move xfs_dir_ialloc to libxfs, and make xfs_ialloc static since we only needed it to be non-static temporarily. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: refactor special inode roll out of xfs_dir_iallocDarrick J. Wong
In xfs_dir_ialloc, we roll the transaction if we had to allocate a new inode chunk and before we actually initialize the inode. In the kernel this requires us to detach the transaction's quota charge information from the ichunk allocation transaction and to attach it the ialloc transaction because we don't charge quota for inode chunks. This doesn't exist in the userspace side of things, so pop it out into a separately called function. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: push xfs_ialloc_args creation out of xfs_dir_iallocDarrick J. Wong
Move the initialization of the xfs_ialloc_args structure out of xfs_dir_ialloc into its callers' callers so that we can set the new inode's parameters in one place and pass it through instead of open coding the new uid/gid/prid all over the code. This also prepares us for moving xfs_dir_ialloc and xfs_create to libxfs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: hoist inode allocation functionDarrick J. Wong
Move the inode allocation function into libxfs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: delegate post-allocation igetDarrick J. Wong
Create a post-allocation iget helper so that the upcoming libxfs hoist doesn't have to determine the xfs_iget interface. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: split inode allocation and initializationDarrick J. Wong
Split new inode allocation and initialization into separate helpers. Eventually we'll supply a force-reinitialization function so that xfs_repair can use libxfs to reset the root directory and friends. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: use xfs_trans_ichgtime to set times when allocating inodeDarrick J. Wong
Use xfs_trans_ichgtime to set the inode times when allocating an inode, instead of open-coding them here. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: implement atime updates in xfs_trans_ichgtimeDarrick J. Wong
Enable xfs_trans_ichgtime to change the inode access time so that we can use this function to set inode times when allocating inodes instead of open-coding it. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: pack inode allocation parameters into a separate structureDarrick J. Wong
Instead of open-coding new inode parameters through xfs_dir_ialloc and xfs_Ialloc, put everything into a structure and pass that instead. This will make it easier to share code with xfsprogs while maintaining the ability for xfsprogs to supply extra new inode parameters. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: hoist project id get/set functionsDarrick J. Wong
Move the project id get and set functions into libxfs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: hoist inode flag conversion functionsDarrick J. Wong
Hoist the inode flag conversion functions into libxfs so that we can keep them in sync. Do this by creating a new xfs_inode_utils.c file in libxfs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: hoist extent size helpers to libxfsDarrick J. Wong
Move the extent size helpers to xfs_bmap.c in libxfs since they're used there already. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: repair summary countersrepair-hard-problems_2019-10-09Darrick J. Wong
Use the same summary counter calculation infrastructure to generate new values for the in-core summary counters. The difference between the scrubber and the repairer is that the repairer will freeze the fs during setup, which means that the values should match exactly. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: implement live quotacheck as part of quota repairDarrick J. Wong
Use the fs freezing mechanism we developed for the rmapbt repair to freeze the fs, this time to scan the fs for a live quotacheck. We add a new dqget variant to use the existing scrub transaction to allocate an on-disk dquot block if it is missing. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: repair the rmapbtDarrick J. Wong
Rebuild the reverse mapping btree from all primary metadata. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: make xfile io asynchronousDarrick J. Wong
Use a workqueue thread to call xfile io operations because lockdep complains when we freeze the filesystem. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: introduce online scrub freezeDarrick J. Wong
Introduce a new 'online scrub freeze' that we can use to lock out all filesystem modifications and background activity so that we can perform global scans in order to rebuild metadata. This introduces a new IFLAG to the scrub ioctl to indicate that userspace is willing to allow a freeze. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: update health status if we get a clean bill of healthindirect-health-reporting_2019-10-09Darrick J. Wong
If scrub finds that everything is ok with the filesystem, we need a way to tell the health tracking that it can let go of indirect health flags, since indirect flags only mean that at some point in the past we lost some context. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: remember sick inodes that get inactivatedDarrick J. Wong
If an unhealthy inode gets inactivated, remember this fact in the per-fs health summary. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: add secondary and indirect classes to the health tracking systemDarrick J. Wong
Establish two more classes of health tracking bits: * Indirect problems, which suggest problems in other health domains that we weren't able to preserve. * Secondary problems, which track state that's related to primary evidence of health problems; and The first class we'll use in an upcoming patch to record in the AG health status the fact that we ran out of memory and had to inactivate an inode with defective metadata. The second class we use to indicate that repair knows that an inode is bad and we need to fix it later. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: create a polled function to force inode inactivationdeferred-inactivation_2019-10-09Darrick J. Wong
Create a polled version of xfs_inactive_force so that we can force inactivation while holding a lock (usually the umount lock) without tripping over the softlockup timer. This is for callers that hold vfs locks while calling inactivation, which is currently unmount, iunlink processing during mount, and rw->ro remount. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: parallelize inode inactivationDarrick J. Wong
Split the inode inactivation work into per-AG work items so that we can take advantage of parallelization. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: force inactivation before fallocate when space is lowDarrick J. Wong
If we think that inactivation will free enough blocks to make it easier to satisfy an fallocate request, force inactivation. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: force inode inactivation and retry fs writes when there isn't spaceDarrick J. Wong
Any time we try to modify a file's contents and it fails due to ENOSPC or EDQUOT, force inactivation work to free up some resources and try one more time. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: deferred inode inactivationDarrick J. Wong
Instead of calling xfs_inactive directly from xfs_fs_destroy_inode, defer the inactivation phase to a separate workqueue. With this we avoid blocking memory reclaim on filesystem metadata updates that are necessary to free an in-core inode, such as post-eof block freeing, COW staging extent freeing, and truncating and freeing unlinked inodes. Now that work is deferred to a workqueue where we can do the freeing in batches. We introduce two new inode flags -- NEEDS_INACTIVE and INACTIVATING. The first flag helps our worker find inodes needing inactivation, and the second flag marks inodes that are in the process of being inactivated. A concurrent xfs_iget on the inode can still resurrect the inode by clearing NEEDS_INACTIVE (or bailing if INACTIVATING is set). Unfortunately, deferring the inactivation has one huge downside -- eventual consistency. Since all the freeing is deferred to a worker thread, one can rm a file but the space doesn't come back immediately. This can cause some odd side effects with quota accounting and statfs, so we also force inactivation scans in order to maintain the existing behaviors, at least outwardly. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-10-09xfs: pass around xfs_inode_ag_walk iget/irele helper functionsDarrick J. Wong
Create an alternative version of xfs_ici_walk() that allow a caller to pass in custom inode grab and inode release helper functions. Deferred inode inactivation deals with xfs inodes that are still in memory but no longer visible to the vfs, which means that it has to screen and process those inodes differently. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>