aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_util.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2013-12-18 05:14:39 -0500
committerBen Myers <bpm@sgi.com>2013-12-18 16:48:44 -0500
commitefa70be165497826f674846f681e6e2364af906c (patch)
tree484e876ef92c632e062ccac613f9a066f4b714db /fs/xfs/xfs_bmap_util.c
parent309ecac8e7c937c5811ef8f0efc14b3d1bd18775 (diff)
xfs: add xfs_ilock_attr_map_shared
Equivalent to xfs_ilock_data_map_shared, except for the attribute fork. Make xfs_getbmap use it if called for the attribute fork instead of xfs_ilock_data_map_shared. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
-rw-r--r--fs/xfs/xfs_bmap_util.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 460aeb87c04e..374ba050942f 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -617,22 +617,27 @@ xfs_getbmap(
617 return XFS_ERROR(ENOMEM); 617 return XFS_ERROR(ENOMEM);
618 618
619 xfs_ilock(ip, XFS_IOLOCK_SHARED); 619 xfs_ilock(ip, XFS_IOLOCK_SHARED);
620 if (whichfork == XFS_DATA_FORK && !(iflags & BMV_IF_DELALLOC)) { 620 if (whichfork == XFS_DATA_FORK) {
621 if (ip->i_delayed_blks || XFS_ISIZE(ip) > ip->i_d.di_size) { 621 if (!(iflags & BMV_IF_DELALLOC) &&
622 (ip->i_delayed_blks || XFS_ISIZE(ip) > ip->i_d.di_size)) {
622 error = -filemap_write_and_wait(VFS_I(ip)->i_mapping); 623 error = -filemap_write_and_wait(VFS_I(ip)->i_mapping);
623 if (error) 624 if (error)
624 goto out_unlock_iolock; 625 goto out_unlock_iolock;
626
627 /*
628 * Even after flushing the inode, there can still be
629 * delalloc blocks on the inode beyond EOF due to
630 * speculative preallocation. These are not removed
631 * until the release function is called or the inode
632 * is inactivated. Hence we cannot assert here that
633 * ip->i_delayed_blks == 0.
634 */
625 } 635 }
626 /*
627 * even after flushing the inode, there can still be delalloc
628 * blocks on the inode beyond EOF due to speculative
629 * preallocation. These are not removed until the release
630 * function is called or the inode is inactivated. Hence we
631 * cannot assert here that ip->i_delayed_blks == 0.
632 */
633 }
634 636
635 lock = xfs_ilock_data_map_shared(ip); 637 lock = xfs_ilock_data_map_shared(ip);
638 } else {
639 lock = xfs_ilock_attr_map_shared(ip);
640 }
636 641
637 /* 642 /*
638 * Don't let nex be bigger than the number of extents 643 * Don't let nex be bigger than the number of extents