diff options
author | Gustavo Padovan <gustavo.padovan@collabora.com> | 2018-07-06 13:34:13 -0300 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.com> | 2018-07-06 13:34:13 -0300 |
commit | e22e953189f7b3a3bfc7efb511d2b1d1454adde5 (patch) | |
tree | 87e56e966e1f676f2c9389c41aa5c37969f757f1 /fs/xfs/libxfs/xfs_bmap.c | |
parent | a012024571d98e2e4bf29a9168fb7ddc44b7ab86 (diff) | |
parent | 4da1d4c751c9b1b713c13043bad7c4d27cd1418c (diff) | |
download | talos-op-linux-e22e953189f7b3a3bfc7efb511d2b1d1454adde5.tar.gz talos-op-linux-e22e953189f7b3a3bfc7efb511d2b1d1454adde5.zip |
Merge drm-upstream/drm-next into drm-misc-next
Pull in the malidp writeback implementation for further work on writeback in drm-misc-next.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_bmap.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 01628f0c9a0c..7205268b30bc 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5780,6 +5780,32 @@ del_cursor: return error; } +/* Make sure we won't be right-shifting an extent past the maximum bound. */ +int +xfs_bmap_can_insert_extents( + struct xfs_inode *ip, + xfs_fileoff_t off, + xfs_fileoff_t shift) +{ + struct xfs_bmbt_irec got; + int is_empty; + int error = 0; + + ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); + + if (XFS_FORCED_SHUTDOWN(ip->i_mount)) + return -EIO; + + xfs_ilock(ip, XFS_ILOCK_EXCL); + error = xfs_bmap_last_extent(NULL, ip, XFS_DATA_FORK, &got, &is_empty); + if (!error && !is_empty && got.br_startoff >= off && + ((got.br_startoff + shift) & BMBT_STARTOFF_MASK) < got.br_startoff) + error = -EINVAL; + xfs_iunlock(ip, XFS_ILOCK_EXCL); + + return error; +} + int xfs_bmap_insert_extents( struct xfs_trans *tp, |