@@ -939,7 +939,7 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int whence)
case SEEK_DATA:
inode_lock_shared(inode);
offset = iomap_seek(inode, offset, &ext4_iomap_report_ops,
- whence == SEEK_HOLE);
+ whence == SEEK_HOLE, false);
inode_unlock_shared(inode);
break;
}
@@ -2111,7 +2111,7 @@ loff_t gfs2_seek_data(struct file *file, loff_t offset)
inode_lock_shared(inode);
ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
if (!ret)
- ret = iomap_seek(inode, offset, &gfs2_iomap_ops, false);
+ ret = iomap_seek(inode, offset, &gfs2_iomap_ops, false, false);
gfs2_glock_dq_uninit(&gh);
inode_unlock_shared(inode);
@@ -2130,7 +2130,7 @@ loff_t gfs2_seek_hole(struct file *file, loff_t offset)
inode_lock_shared(inode);
ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
if (!ret)
- ret = iomap_seek(inode, offset, &gfs2_iomap_ops, true);
+ ret = iomap_seek(inode, offset, &gfs2_iomap_ops, true, false);
gfs2_glock_dq_uninit(&gh);
inode_unlock_shared(inode);
@@ -52,7 +52,7 @@ static loff_t iomap_seek_data_iter(const struct iomap_iter *iter,
loff_t
iomap_seek(struct inode *inode, loff_t pos, const struct iomap_ops *ops,
- bool hole)
+ bool hole, bool nowait)
{
loff_t size = i_size_read(inode);
struct iomap_iter iter = {
@@ -66,6 +66,8 @@ iomap_seek(struct inode *inode, loff_t pos, const struct iomap_ops *ops,
if (pos < 0 || pos >= size)
return -ENXIO;
+ if (nowait)
+ iter.flags |= IOMAP_NOWAIT;
iter.len = size - pos;
while ((ret = iomap_iter(&iter, ops)) > 0)
iter.processed = hole ? iomap_seek_hole_iter(&iter, &pos) :
@@ -1273,7 +1273,7 @@ xfs_file_llseek(
case SEEK_HOLE:
case SEEK_DATA:
offset = iomap_seek(inode, offset, &xfs_seek_iomap_ops,
- whence == SEEK_HOLE);
+ whence == SEEK_HOLE, nowait);
break;
}
@@ -275,7 +275,7 @@ vm_fault_t iomap_page_mkwrite(struct vm_fault *vmf,
int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
u64 start, u64 len, const struct iomap_ops *ops);
loff_t iomap_seek(struct inode *inode, loff_t offset,
- const struct iomap_ops *ops, bool hole);
+ const struct iomap_ops *ops, bool hole, bool nowait);
sector_t iomap_bmap(struct address_space *mapping, sector_t bno,
const struct iomap_ops *ops);