aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/file.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2017-03-15 19:12:59 +0100
committerAndreas Gruenbacher <agruenba@redhat.com>2017-10-31 14:26:35 +0100
commit3a27411cb4bc3ce31db228e3569ad01b462a4310 (patch)
tree368d27aa18ab8867bfb8443b2223d7de421f0123 /fs/gfs2/file.c
parentGFS2: Switch fiemap implementation to use iomap (diff)
downloadlinux-dev-3a27411cb4bc3ce31db228e3569ad01b462a4310.tar.xz
linux-dev-3a27411cb4bc3ce31db228e3569ad01b462a4310.zip
gfs2: Implement SEEK_HOLE / SEEK_DATA via iomap
So far, lseek on gfs2 did not report holes. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r--fs/gfs2/file.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index c7a904a8fbb4..8fefb80fe830 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -60,9 +60,7 @@ static loff_t gfs2_llseek(struct file *file, loff_t offset, int whence)
loff_t error;
switch (whence) {
- case SEEK_END: /* These reference inode->i_size */
- case SEEK_DATA:
- case SEEK_HOLE:
+ case SEEK_END:
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
&i_gh);
if (!error) {
@@ -70,8 +68,21 @@ static loff_t gfs2_llseek(struct file *file, loff_t offset, int whence)
gfs2_glock_dq_uninit(&i_gh);
}
break;
+
+ case SEEK_DATA:
+ error = gfs2_seek_data(file, offset);
+ break;
+
+ case SEEK_HOLE:
+ error = gfs2_seek_hole(file, offset);
+ break;
+
case SEEK_CUR:
case SEEK_SET:
+ /*
+ * These don't reference inode->i_size and don't depend on the
+ * block mapping, so we don't need the glock.
+ */
error = generic_file_llseek(file, offset, whence);
break;
default: