Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09a4707e authored by Pavel Shilovsky's avatar Pavel Shilovsky Committed by Steve French
Browse files

CIFS: Add SMB2 support for cifs_iovec_read

parent fc9c5966
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -857,12 +857,37 @@ struct cifsFileInfo {

struct cifs_io_parms {
	__u16 netfid;
#ifdef CONFIG_CIFS_SMB2
	__u64 persistent_fid;	/* persist file id for smb2 */
	__u64 volatile_fid;	/* volatile file id for smb2 */
#endif
	__u32 pid;
	__u64 offset;
	unsigned int length;
	struct cifs_tcon *tcon;
};

struct cifs_readdata;

/* asynchronous read support */
struct cifs_readdata {
	struct kref			refcount;
	struct list_head		list;
	struct completion		done;
	struct cifsFileInfo		*cfile;
	struct address_space		*mapping;
	__u64				offset;
	unsigned int			bytes;
	pid_t				pid;
	int				result;
	struct list_head		pages;
	struct work_struct		work;
	int (*marshal_iov) (struct cifs_readdata *rdata,
			    unsigned int remaining);
	unsigned int			nr_iov;
	struct kvec			iov[1];
};

/*
 * Take a reference on the file private data. Must be called with
 * cifs_file_list_lock held.
+1 −19
Original line number Diff line number Diff line
@@ -464,27 +464,9 @@ extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8,
			unsigned char *p24);

/* asynchronous read support */
struct cifs_readdata {
	struct kref			refcount;
	struct list_head		list;
	struct completion		done;
	struct cifsFileInfo		*cfile;
	struct address_space		*mapping;
	__u64				offset;
	unsigned int			bytes;
	pid_t				pid;
	int				result;
	struct list_head		pages;
	struct work_struct		work;
	int (*marshal_iov) (struct cifs_readdata *rdata,
			    unsigned int remaining);
	unsigned int			nr_iov;
	struct kvec			iov[1];
};

void cifs_readdata_release(struct kref *refcount);
int cifs_async_readv(struct cifs_readdata *rdata);
int cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid);

/* asynchronous write support */
struct cifs_writedata {
+1 −1
Original line number Diff line number Diff line
@@ -1440,7 +1440,7 @@ cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid)
	return 0;
}

static int
int
cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
{
	int length, len;
+4 −0
Original line number Diff line number Diff line
@@ -2732,6 +2732,10 @@ cifs_iovec_read(struct file *file, const struct iovec *iov,
	cifs_stats_bytes_read(tcon, total_read);
	*poffset += total_read;

	/* mask nodata case */
	if (rc == -ENODATA)
		rc = 0;

	return total_read ? total_read : rc;
}

+6 −0
Original line number Diff line number Diff line
@@ -41,4 +41,10 @@
#define SMB2_OP_RENAME 6
#define SMB2_OP_DELETE 7

/* Used when constructing chained read requests. */
#define CHAINED_REQUEST 1
#define START_OF_CHAIN 2
#define END_OF_CHAIN 4
#define RELATED_REQUEST 8

#endif	/* _SMB2_GLOB_H */
Loading