summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs
Commit message (Collapse)AuthorAgeFilesLines
...
| * xfs: don't rely on extent indices in xfs_bmap_insert_extentsChristoph Hellwig2017-10-271-38/+9Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite xfs_bmap_insert_extents so that we don't rely on extent indices except for iterating over them. Not being able to iterate to the previous extent or finding the extent that stop_fsb is in are sufficient exit conditions, and we don't need to do any extent count games given that: a) we already flushed all delalloc extents past our start offset before doing the operation b) xfs_iext_count() includes delalloc extents anyway Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: don't rely on extent indices in xfs_bmap_collapse_extentsChristoph Hellwig2017-10-271-42/+12Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite xfs_bmap_collapse_extents so that we don't rely on extent indices except for iterating over them. Not being able to iterate to the next extent is a sufficient exit condition, and we don't need to do any extent count games given that: a) we already flushed all delalloc extents past our start offset before doing the operation b) xfs_iext_count() includes delalloc extents anyway Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: update got in xfs_bmap_shift_update_extentChristoph Hellwig2017-10-271-9/+7Star
| | | | | | | | | | | | | | | | This way the caller gets the proper updated extent returned in got. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: remove xfs_bmse_shift_oneChristoph Hellwig2017-10-272-115/+71Star
| | | | | | | | | | | | | | | | | | | | Instead do the actual left and right shift work in the callers, and just keep a helper to update the bmap and rmap btrees as well as the in-core extent list. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: split xfs_bmap_shift_extentsChristoph Hellwig2017-10-272-65/+142
| | | | | | | | | | | | | | | | | | | | | | | | Have a separate helper for insert vs collapse, as this prepares us for simplifying the code in the next patches. Also changed the done output argument to a bool intead of int for both new functions. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: remove XFS_BMAP_MAX_SHIFT_EXTENTSChristoph Hellwig2017-10-272-38/+21Star
| | | | | | | | | | | | | | | | | | | | | | | | | | The define was always set to 1, which means looping until we reach is was dead code from the start. Also remove an initialization of next_fsb for the done case that doesn't fit the new code flow - it was never checked by the caller in the done case to start with. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: remove if_rdevChristoph Hellwig2017-10-272-18/+21
| | | | | | | | | | | | | | | | | | We can simply use the i_rdev field in the Linux inode and just convert to and from the XFS dev_t when reading or logging/writing the inode. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: remove the never fully implemented UUID fork formatChristoph Hellwig2017-10-276-30/+12Star
| | | | | | | | | | | | | | | | | | Remove the dead code dealing with the UUID fork format that was never implemented in Linux (and neither in IRIX as far as I know). Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: remove XFS_BMAP_TRACE_EXLISTChristoph Hellwig2017-10-273-32/+8Star
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of looping over all extents in some debug-only helper just insert trace points into the loops that already exist in the calling functions. Also split the xfs_extlist trace point into one each for reading and writing extents from disk. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: move pre/post-bmap tracing into xfs_iext_update_extentChristoph Hellwig2017-10-273-123/+55Star
| | | | | | | | | | | | | | | | | | | | | | | | | | xfs_iext_update_extent already has basically all the information needed to centralize the bmap pre/post tracing. We just need to pass inode + bmap state instead of the inode fork pointer to get all trace annotations. In addition to covering all the existing trace points this gives us tracing coverage for the extent shifting operations for free. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: remove post-bmap tracing in xfs_bmap_local_to_extentsChristoph Hellwig2017-10-271-2/+0Star
| | | | | | | | | | | | | | | | | | Now that we use xfs_iext_insert this is already covered by the tracing in that function. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: make better use of the 'state' variable in xfs_bmap_del_extent_realChristoph Hellwig2017-10-271-2/+1Star
| | | | | | | | | | | | | | | | | | We already have all the information about the fork a=D1=95 well as additional tracing information, so pass that to xfs_iext_remove(). Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: add a xfs_bmap_fork_to_state helperChristoph Hellwig2017-10-272-36/+21Star
| | | | | | | | | | | | | | | | | | This creates the right initial bmap state from the passed in inode fork enum. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: scrub quota informationDarrick J. Wong2017-10-271-1/+4
| | | | | | | | | | | | | | Perform some quick sanity testing of the disk quota information. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub realtime bitmap/summaryDarrick J. Wong2017-10-272-1/+8
| | | | | | | | | | | | | | Perform simple tests of the realtime bitmap and summary. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub directory parent pointersDarrick J. Wong2017-10-271-1/+2
| | | | | | | | | | | | | | | | | | Scrub parent pointers, sort of. For directories, we can ride the '..' entry up to the parent to confirm that there's at most one dentry that points back to this directory. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub symbolic linksDarrick J. Wong2017-10-271-1/+2
| | | | | | | | | | | | | | Create the infrastructure to scrub symbolic link data. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub extended attributesDarrick J. Wong2017-10-271-1/+2
| | | | | | | | | | | | | | | | | | Scrub the hash tree, keys, and values in an extended attribute structure. Refactor the attribute code to use the transaction if the caller supplied one to avoid buffer deadocks. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub directory metadataDarrick J. Wong2017-10-273-2/+22
| | | | | | | | | | | | | | Scrub the hash tree and all the entries in a directory. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub inode block mappingsDarrick J. Wong2017-10-271-1/+4
| | | | | | | | | | | | | | Scrub an individual inode's block mappings to make sure they make sense. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub inodesDarrick J. Wong2017-10-271-1/+2
| | | | | | | | | | | | | | Scrub the fields within an inode. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub refcount btreesDarrick J. Wong2017-10-271-1/+2
| | | | | | | | | | | | | | | | | | Plumb in the pieces necessary to check the refcount btree. If rmap is available, check the reference count by performing an interval query against the rmapbt. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub rmap btreesDarrick J. Wong2017-10-271-1/+2
| | | | | | | | | | | | | | | | Check the reverse mapping records to make sure that the contents make sense. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub inode btreesDarrick J. Wong2017-10-272-2/+4
| | | | | | | | | | | | | | | | Check the records of the inode btrees to make sure that the values make sense given the inode records themselves. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub free space btreesDarrick J. Wong2017-10-271-1/+3
| | | | | | | | | | | | | | | | Check the extent records free space btrees to ensure that the values look sane. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub the AGIDarrick J. Wong2017-10-271-1/+2
| | | | | | | | | | | | | | | | Add a forgotten check to the AGI verifier, then wire up the scrub infrastructure to check the AGI contents. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub AGF and AGFLDarrick J. Wong2017-10-271-1/+3
| | | | | | | | | | | | | | | | Check the block references in the AGF and AGFL headers to make sure they make sense. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub the secondary superblocksDarrick J. Wong2017-10-271-1/+2
| | | | | | | | | | | | | | | | | | Ensure that the geometry presented in the backup superblocks matches the primary superblock so that repair can recover the filesystem if that primary gets corrupted. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: scrub the shape of a metadata btreeDarrick J. Wong2017-10-272-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | Create a function that can check the shape of a btree -- each block passes basic inspection and all the pointers look ok. In the next patch we'll add the ability to check the actual keys and records stored within the btree. Add some helper functions so that we report detailed scrub errors in a uniform manner in dmesg. These are helper functions for subsequent patches. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: probe the scrub ioctlDarrick J. Wong2017-10-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Create a probe scrubber with id 0. This will be used by xfs_scrub to probe the kernel's abilities to scrub (and repair) the metadata. We do this by validating the ioctl inputs from userspace, preparing the filesystem for a scrub (or a repair) operation, and immediately returning to userspace. Userspace can use the returned errno and structure state to decide (in broad terms) if scrub/repair are supported by the running kernel. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: create an ioctl to scrub AG metadataDarrick J. Wong2017-10-271-0/+53
| | | | | | | | | | | | | | | | | | | | Create an ioctl that can be used to scrub internal filesystem metadata. The new ioctl takes the metadata type, an (optional) AG number, an (optional) inode number and generation, and a flags argument. This will be used by the upcoming XFS online scrub tool. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: create inode pointer verifiersDarrick J. Wong2017-10-273-16/+100
| | | | | | | | | | | | | | | | | | | | Create some helper functions to check that inode pointers point to somewhere within the filesystem and not at the static AG metadata. Move xfs_internal_inum and create a directory inode check function. We will use these functions in scrub and elsewhere. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: refactor btree block header checking functionsDarrick J. Wong2017-10-273-68/+114
| | | | | | | | | | | | | | | | | | | | Refactor the btree block header checks to have an internal function that returns the address of the failing check without logging errors. The scrubber will call the internal function, while the external version will maintain the current logging behavior. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: refactor btree pointer checksDarrick J. Wong2017-10-273-42/+45
| | | | | | | | | | | | | | | | | | Refactor the btree pointer checks so that we can call them from the scrub code without logging errors to dmesg. Preserve the existing error reporting for regular operations. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: create block pointer check functionsDarrick J. Wong2017-10-273-0/+65
| | | | | | | | | | | | | | | | | | Create some helper functions to check that a block pointer points within the filesystem (or AG) and doesn't point at static metadata. We will use this for scrub. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
| * xfs: remove xfs_bmbt_get_stateChristoph Hellwig2017-10-272-29/+1Star
| | | | | | | | | | | | | | | | | | Unused after the big bmap refactor. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: remove all xfs_bmbt_set_* helpers except for xfs_bmbt_set_allChristoph Hellwig2017-10-272-94/+14Star
| | | | | | | | | | | | | | | | | | Unused after the big bmap refactor. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: replace xfs_bmbt_lookup_ge with xfs_bmbt_lookup_firstChristoph Hellwig2017-10-271-8/+6Star
| | | | | | | | | | | | | | | | | | | | | | We only use xfs_bmbt_lookup_ge to look up the first bmap record in an inode, so replace xfs_bmbt_lookup_ge with a special purpose helper that is a bit more descriptive. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: pass a struct xfs_bmbt_irec to xfs_bmbt_lookup_eqChristoph Hellwig2017-10-271-106/+39Star
| | | | | | | | | | | | | | | | | | | | | | | | | | Now that we've massaged the callers into the right form we can always pass the actual extent record instead of the individual fields. As an additional benefit the btree cursor will now be prepoulated with the correct extent state instead of having to fix it up later. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: pass a struct xfs_bmbt_irec to xfs_bmbt_updateChristoph Hellwig2017-10-273-116/+44Star
| | | | | | | | | | | | | | | | | | | | | | | | | | Now that we've massaged the callers into the right form we can always pass the actual extent record instead of the individual fields. With that xfs_bmbt_disk_set_allf can go away, and xfs_bmbt_disk_set_all can be merged into the former implementation of xfs_bmbt_disk_set_allf. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: refactor xfs_bmap_add_extent_unwritten_realChristoph Hellwig2017-10-271-104/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use xfs_iext_get_extent to find, and xfs_iext_update_extent to update entries in the in-core extent list. This isolates the function from the detailed layout of the extent list, and generally makes the code a lot more readable. Also get rid of the oldext and newext variables as using the extent records is a lot more descriptive. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: refactor delalloc accounting in xfs_bmap_add_extent_delay_realChristoph Hellwig2017-10-271-23/+9Star
| | | | | | | | | | | | | | | | | | | | | | Account for all changes to the delalloc reservation in da_new, and use a single call xfs_mod_fdblocks to reserve/free blocks, including always checking for an error. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: refactor xfs_bmap_add_extent_delay_realChristoph Hellwig2017-10-271-86/+95
| | | | | | | | | | | | | | | | | | | | | | | | Use xfs_iext_get_extent to find, and xfs_iext_update_extent to update entries in the in-core extent list. This isolates the function from the detailed layout of the extent list, and generally makes the code a lot more readable. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: refactor xfs_bmap_add_extent_hole_realChristoph Hellwig2017-10-271-27/+21Star
| | | | | | | | | | | | | | | | | | | | | | Use xfs_iext_update_extent to update entries in the in-core extent list. This isolates the function from the detailed layout of the extent list, and generally makes the code a lot more readable. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: refactor xfs_bmap_add_extent_hole_delayChristoph Hellwig2017-10-271-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | Use xfs_iext_get_extent to find, and xfs_iext_update_extent to update entries in the in-core extent list. This isolates the function from the detailed layout of the extent list, and generally makes the code a lot more readable. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: refactor xfs_del_extent_realChristoph Hellwig2017-10-271-30/+30
| | | | | | | | | | | | | | | | | | | | | | Use xfs_iext_update_extent to update entries in the in-core extent list. This isolates the function from the detailed layout of the extent list, and generally makes the code a lot more readable. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: use the state defines in xfs_bmap_del_extent_realChristoph Hellwig2017-10-271-12/+9Star
| | | | | | | | | | | | | | | | | | | | Use the same defines as the other extent add and delete helpers, which both improves code readability and trace point output. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: use correct state defines in xfs_bmap_del_extent_{cow,delay}Christoph Hellwig2017-10-271-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | Use the _FILLING values to match the usage in the xfs_bmap_add_extent_* helpers. No change in behavior, just better naming in the code and tracepoint output. Signed-off-by: Christoph Hellwig <hch@lst.de> Reported-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: move some more code into xfs_bmap_del_extent_realChristoph Hellwig2017-10-271-24/+17Star
| | | | | | | | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
| * xfs: use xfs_bmap_del_extent_delay for the data fork as wellChristoph Hellwig2017-10-271-217/+114Star
| | | | | | | | | | | | | | | | | | | | | | And remove the delalloc code from xfs_bmap_del_extent, which gets renamed to xfs_bmap_del_extent_real to fit the naming scheme used by the other xfs_bmap_{add,del}_extent_* routines. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>