Skip to contentSkip to conversation

cifs: add support for SEEK_DATA and SEEK_HOLE

PATCH New Ronnie Sahlberg 1 participant 2 messages May 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover cifs: add support for SEEK_DATA and SEEK_HOLE

Resending, I think something went wrong.

Steve,
Support for SEEK_DATA/HOLE.
It passes xfstests 285,286,436,445,448,490

#1 lore raw

PATCH 1/1 cifs: add support for SEEK_DATA and SEEK_HOLE

---
 fs/cifs/cifsfs.c   |  9 ++++++
 fs/cifs/cifsglob.h |  2 ++
 fs/cifs/smb2ops.c  | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+)
fs/cifs/cifsfs.c +9 -0
index b1a5fcfa3ce1..75fef9fb78d8 100644
@@ -878,6 +878,9 @@ static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 
 static loff_t cifs_llseek(struct file *file, loff_t offset, int whence)
 {
+	struct cifsFileInfo *cfile = file->private_data;
+	struct cifs_tcon *tcon;
+
 	/*
 	 * whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
 	 * the cached file length
@@ -909,6 +912,12 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int whence)
 		if (rc < 0)
 			return (loff_t)rc;
 	}
+	if (cfile && cfile->tlink) {
+		tcon = tlink_tcon(cfile->tlink);
+		if (tcon->ses->server->ops->llseek)
+			return tcon->ses->server->ops->llseek(file, tcon,
+							      offset, whence);
+	}
 	return generic_file_llseek(file, offset, whence);
 }
 
fs/cifs/cifsglob.h +2 -0
index 33c251b408aa..334ff5f9c3f3 100644
@@ -497,6 +497,8 @@ struct smb_version_operations {
 	/* version specific fiemap implementation */
 	int (*fiemap)(struct cifs_tcon *tcon, struct cifsFileInfo *,
 		      struct fiemap_extent_info *, u64, u64);
+	/* version specific llseek implementation */
+	loff_t (*llseek)(struct file *, struct cifs_tcon *, loff_t, int);
 };
 
 struct smb_version_values {
fs/cifs/smb2ops.c +88 -0

118 lines not on this page · raw message

Signature · 1 line
2.13.6