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

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

CIFS: Add SMB2 support for cifs_iovec_write

parent c9de5c80
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -89,6 +89,10 @@ extern mempool_t *cifs_mid_poolp;

struct workqueue_struct	*cifsiod_wq;

#ifdef CONFIG_HIGHMEM
DEFINE_MUTEX(cifs_kmap_mutex);
#endif

static int
cifs_read_super(struct super_block *sb)
{
+47 −0
Original line number Diff line number Diff line
@@ -582,6 +582,33 @@ get_next_mid(struct TCP_Server_Info *server)
#define CIFS_KMAP_SIZE_LIMIT   (1<<24)
#endif /* CONFIG_HIGHMEM */

#ifdef CONFIG_HIGHMEM
/*
 * On arches that have high memory, kmap address space is limited. By
 * serializing the kmap operations on those arches, we ensure that we don't
 * end up with a bunch of threads in writeback with partially mapped page
 * arrays, stuck waiting for kmap to come back. That situation prevents
 * progress and can deadlock.
 */

extern struct mutex cifs_kmap_mutex;

static inline void
cifs_kmap_lock(void)
{
	mutex_lock(&cifs_kmap_mutex);
}

static inline void
cifs_kmap_unlock(void)
{
	mutex_unlock(&cifs_kmap_mutex);
}
#else /* !CONFIG_HIGHMEM */
#define cifs_kmap_lock() do { ; } while (0)
#define cifs_kmap_unlock() do { ; } while (0)
#endif /* CONFIG_HIGHMEM */

/*
 * Macros to allow the TCP_Server_Info->net field and related code to drop out
 * when CONFIG_NET_NS isn't set.
@@ -891,6 +918,26 @@ struct cifs_readdata {
	struct kvec			iov[1];
};

struct cifs_writedata;

/* asynchronous write support */
struct cifs_writedata {
	struct kref			refcount;
	struct list_head		list;
	struct completion		done;
	enum writeback_sync_modes	sync_mode;
	struct work_struct		work;
	struct cifsFileInfo		*cfile;
	__u64				offset;
	pid_t				pid;
	unsigned int			bytes;
	int				result;
	void (*marshal_iov) (struct kvec *iov,
			     struct cifs_writedata *wdata);
	unsigned int			nr_pages;
	struct page			*pages[1];
};

/*
 * Take a reference on the file private data. Must be called with
 * cifs_file_list_lock held.
+0 −18
Original line number Diff line number Diff line
@@ -468,24 +468,6 @@ 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 {
	struct kref			refcount;
	struct list_head		list;
	struct completion		done;
	enum writeback_sync_modes	sync_mode;
	struct work_struct		work;
	struct cifsFileInfo		*cfile;
	__u64				offset;
	pid_t				pid;
	unsigned int			bytes;
	int				result;
	void (*marshal_iov) (struct kvec *iov,
			     struct cifs_writedata *wdata);
	unsigned int			nr_pages;
	struct page			*pages[1];
};

int cifs_async_writev(struct cifs_writedata *wdata);
void cifs_writev_complete(struct work_struct *work);
struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages,
+0 −26
Original line number Diff line number Diff line
@@ -86,32 +86,6 @@ static struct {
#endif /* CONFIG_CIFS_WEAK_PW_HASH */
#endif /* CIFS_POSIX */

#ifdef CONFIG_HIGHMEM
/*
 * On arches that have high memory, kmap address space is limited. By
 * serializing the kmap operations on those arches, we ensure that we don't
 * end up with a bunch of threads in writeback with partially mapped page
 * arrays, stuck waiting for kmap to come back. That situation prevents
 * progress and can deadlock.
 */
static DEFINE_MUTEX(cifs_kmap_mutex);

static inline void
cifs_kmap_lock(void)
{
	mutex_lock(&cifs_kmap_mutex);
}

static inline void
cifs_kmap_unlock(void)
{
	mutex_unlock(&cifs_kmap_mutex);
}
#else /* !CONFIG_HIGHMEM */
#define cifs_kmap_lock() do { ; } while(0)
#define cifs_kmap_unlock() do { ; } while(0)
#endif /* CONFIG_HIGHMEM */

/*
 * Mark as invalid, all open files on tree connections since they
 * were closed when session to server was lost.
+1 −0
Original line number Diff line number Diff line
@@ -434,6 +434,7 @@ struct smb_version_operations smb21_operations = {
	.close = smb2_close_file,
	.flush = smb2_flush_file,
	.async_readv = smb2_async_readv,
	.async_writev = smb2_async_writev,
};

struct smb_version_values smb21_values = {
Loading