linux-stable/fs/xfs/libxfs
Omar Sandoval c44245b3d5 xfs: fix inobt inode allocation search optimization
When we try to allocate a free inode by searching the inobt, we try to
find the inode nearest the parent inode by searching chunks both left
and right of the chunk containing the parent. As an optimization, we
cache the leftmost and rightmost records that we previously searched; if
we do another allocation with the same parent inode, we'll pick up the
search where it last left off.

There's a bug in the case where we found a free inode to the left of the
parent's chunk: we need to update the cached left and right records, but
because we already reassigned the right record to point to the left, we
end up assigning the left record to both the cached left and right
records.

This isn't a correctness problem strictly, but it can result in the next
allocation rechecking chunks unnecessarily or allocating inodes further
away from the parent than it needs to. Fix it by swapping the record
pointer after we update the cached left and right records.

Fixes: bd16956599 ("xfs: speed up free inode search")
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-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>
2017-08-11 16:56:33 -07:00
..
xfs_ag_resv.c xfs: remove unneeded parameter from XFS_TEST_ERROR 2017-06-27 18:23:20 -07:00
xfs_ag_resv.h xfs: set up per-AG free space reservations 2016-09-19 10:30:52 +10:00
xfs_alloc.c xfs: remove unneeded parameter from XFS_TEST_ERROR 2017-06-27 18:23:20 -07:00
xfs_alloc.h xfs: export various function for the online scrubber 2017-06-19 14:11:34 -07:00
xfs_alloc_btree.c xfs: always compile the btree inorder check functions 2017-06-19 14:11:33 -07:00
xfs_alloc_btree.h
xfs_attr.c xfs: fixup xfs_attr_get_ilocked 2017-07-13 14:55:05 -07:00
xfs_attr_leaf.c xfs: don't crash on unexpected holes in dir/attr btrees 2017-07-07 18:55:17 -07:00
xfs_attr_leaf.h Merge branch 'xfs-4.10-misc-fixes-3' into for-next 2016-12-07 17:42:30 +11:00
xfs_attr_remote.c xfs: pass along transaction context when reading xattr block buffers 2017-06-20 10:45:22 -07:00
xfs_attr_remote.h
xfs_attr_sf.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_bit.c libxfs: Optimize the loop for xfs_bitmap_empty 2016-01-04 16:10:19 +11:00
xfs_bit.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_bmap.c xfs: fix multi-AG deadlock in xfs_bunmapi 2017-07-26 08:20:03 -07:00
xfs_bmap.h xfs: try to avoid blowing out the transaction reservation when bunmaping a shared extent 2017-06-19 08:59:10 -07:00
xfs_bmap_btree.c xfs: plumb in needed functions for range querying of various btrees 2017-06-19 14:11:34 -07:00
xfs_bmap_btree.h xfs: simplify validation of the unwritten extent bit 2017-04-25 09:40:41 -07:00
xfs_btree.c xfs: check _btree_check_block value 2017-07-20 14:42:32 -07:00
xfs_btree.h xfs: export various function for the online scrubber 2017-06-19 14:11:34 -07:00
xfs_cksum.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_da_btree.c xfs: don't crash on unexpected holes in dir/attr btrees 2017-07-07 18:55:17 -07:00
xfs_da_btree.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_da_format.c xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_da_format.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_defer.c xfs: defer should abort intent items if the trans roll fails 2016-10-24 14:21:18 +11:00
xfs_defer.h xfs: implement deferred bmbt map/unmap operations 2016-10-04 11:05:44 -07:00
xfs_dir2.c xfs: remove unneeded parameter from XFS_TEST_ERROR 2017-06-27 18:23:20 -07:00
xfs_dir2.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_dir2_block.c xfs: don't crash on unexpected holes in dir/attr btrees 2017-07-07 18:55:17 -07:00
xfs_dir2_data.c xfs: check that dir block entries don't off the end of the buffer 2017-07-25 08:36:35 -07:00
xfs_dir2_leaf.c xfs: don't crash on unexpected holes in dir/attr btrees 2017-07-07 18:55:17 -07:00
xfs_dir2_node.c xfs: return the hash value of a leaf1 directory block 2017-06-20 10:45:21 -07:00
xfs_dir2_priv.h xfs: pass along transaction context when reading directory block buffers 2017-06-20 10:45:22 -07:00
xfs_dir2_sf.c xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_dquot_buf.c xfs: simplify xfs_calc_dquots_per_chunk 2017-04-12 08:42:51 -07:00
xfs_format.h xfs: rename MAXPATHLEN to XFS_SYMLINK_MAXLEN 2017-07-07 08:37:26 -07:00
xfs_fs.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_ialloc.c xfs: fix inobt inode allocation search optimization 2017-08-11 16:56:33 -07:00
xfs_ialloc.h xfs: export _inobt_btrec_to_irec and _ialloc_cluster_alignment for scrub 2017-06-19 14:11:34 -07:00
xfs_ialloc_btree.c xfs: plumb in needed functions for range querying of various btrees 2017-06-19 14:11:34 -07:00
xfs_ialloc_btree.h xfs: use per-AG reservations for the finobt 2017-01-25 07:49:35 -08:00
xfs_inode_buf.c xfs: remove unneeded parameter from XFS_TEST_ERROR 2017-06-27 18:23:20 -07:00
xfs_inode_buf.h xfs: export various function for the online scrubber 2017-06-19 14:11:34 -07:00
xfs_inode_fork.c xfs: simplify validation of the unwritten extent bit 2017-04-25 09:40:41 -07:00
xfs_inode_fork.h xfs: rework the inline directory verifiers 2017-04-03 12:22:20 -07:00
xfs_log_format.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_log_recover.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_log_rlimit.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_quota_defs.h Revert "xfs: grab dquots without taking the ilock" 2017-07-13 14:55:05 -07:00
xfs_refcount.c xfs: check _alloc_read_agf buffer pointer before using 2017-07-20 14:42:33 -07:00
xfs_refcount.h xfs: try to avoid blowing out the transaction reservation when bunmaping a shared extent 2017-06-19 08:59:10 -07:00
xfs_refcount_btree.c xfs: always compile the btree inorder check functions 2017-06-19 14:11:33 -07:00
xfs_refcount_btree.h xfs: use the actual AG length when reserving blocks 2017-01-03 18:39:33 -08:00
xfs_rmap.c xfs: remove unneeded parameter from XFS_TEST_ERROR 2017-06-27 18:23:20 -07:00
xfs_rmap.h xfs: export various function for the online scrubber 2017-06-19 14:11:34 -07:00
xfs_rmap_btree.c xfs: always compile the btree inorder check functions 2017-06-19 14:11:33 -07:00
xfs_rmap_btree.h xfs: use the actual AG length when reserving blocks 2017-01-03 18:39:33 -08:00
xfs_rtbitmap.c xfs: export various function for the online scrubber 2017-06-19 14:11:34 -07:00
xfs_sb.c xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00
xfs_sb.h xfs: remove unused function definitions 2016-02-08 14:58:07 +11:00
xfs_shared.h xfs: define the on-disk refcount btree format 2016-10-03 09:11:18 -07:00
xfs_symlink_remote.c xfs: rename MAXPATHLEN to XFS_SYMLINK_MAXLEN 2017-07-07 08:37:26 -07:00
xfs_trans_resv.c xfs: rename MAXPATHLEN to XFS_SYMLINK_MAXLEN 2017-07-07 08:37:26 -07:00
xfs_trans_resv.h xfs: increase log reservations for reflink 2016-10-05 16:26:29 -07:00
xfs_trans_space.h xfs: reserve enough blocks to handle btree splits when remapping 2017-05-03 13:21:40 -07:00
xfs_types.h xfs: remove double-underscore integer types 2017-06-19 14:11:33 -07:00