From patchwork Wed Jul 18 15:48:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 1212111 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 40C863FD4F for ; Wed, 18 Jul 2012 15:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754749Ab2GRPul (ORCPT ); Wed, 18 Jul 2012 11:50:41 -0400 Received: from mail-ee0-f46.google.com ([74.125.83.46]:33500 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754501Ab2GRPuk (ORCPT ); Wed, 18 Jul 2012 11:50:40 -0400 Received: by mail-ee0-f46.google.com with SMTP id c13so594931eek.19 for ; Wed, 18 Jul 2012 08:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=5UFEKW7OzNreGQDXxswIWdgF0028eeFq+ck2sURK580=; b=OALVdL4bGw8b7ihObm/TU/CgB6TstWuX7+sUHqfdovuvC5fSIIN2G3v45pYBD7pNsX 9kXgVvALbLikDtmf3adDdYyxUPrAIcjxYbsCkV08jKEcKyBGH26P9fW9Wl+irICtYOw2 Hzee0TEH5RB3xVrwEHyzdg5O3E1a5ESiFgBODhj2634nPNmnaoDyfBqVNjvENuTDXeBl DrVwTCk9QEW/GTXjPlM7D3ixTfWNL8b6x9pil+bwxqzKYJ+DUtU4HsoZsDfzdPvHWE3U Qli2FcjulCDu2mBTj7YSQFXfhMF3kgft354n6Fo9Xw40rdY5eO8jemXjlu7ijvTu+5Q+ NNtQ== Received: by 10.152.112.34 with SMTP id in2mr4125344lab.6.1342626639824; Wed, 18 Jul 2012 08:50:39 -0700 (PDT) Received: from localhost.localdomain ([178.45.208.11]) by mx.google.com with ESMTPS id p2sm4826985lbj.4.2012.07.18.08.50.37 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jul 2012 08:50:38 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 24/45] CIFS: Move async write to ops struct Date: Wed, 18 Jul 2012 19:48:40 +0400 Message-Id: <1342626541-29872-25-git-send-email-pshilovsky@samba.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1342626541-29872-1-git-send-email-pshilovsky@samba.org> References: <1342626541-29872-1-git-send-email-pshilovsky@samba.org> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Pavel Shilovsky --- fs/cifs/cifsglob.h | 3 +++ fs/cifs/cifssmb.c | 4 +++- fs/cifs/file.c | 13 +++++++++++-- fs/cifs/smb1ops.c | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 9ce1353..61a013e 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -173,6 +173,7 @@ struct cifs_fattr; struct smb_vol; struct cifs_fid; struct cifs_readdata; +struct cifs_writedata; struct smb_version_operations { int (*send_cancel)(struct TCP_Server_Info *, void *, @@ -283,6 +284,8 @@ struct smb_version_operations { int (*flush)(const unsigned int, struct cifs_tcon *, struct cifs_fid *); /* async read from the server */ int (*async_readv)(struct cifs_readdata *); + /* async write to the server */ + int (*async_writev)(struct cifs_writedata *); }; struct smb_version_values { diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index e37801c..715781a 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -1921,6 +1921,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata) { int i, rc; struct inode *inode = wdata->cfile->dentry->d_inode; + struct TCP_Server_Info *server; for (i = 0; i < wdata->nr_pages; i++) { lock_page(wdata->pages[i]); @@ -1928,7 +1929,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata) } do { - rc = cifs_async_writev(wdata); + server = tlink_tcon(wdata->cfile->tlink)->ses->server; + rc = server->ops->async_writev(wdata); } while (rc == -EAGAIN); for (i = 0; i < wdata->nr_pages; i++) { diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 81403ad..fd2c8bb 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1747,6 +1747,7 @@ static int cifs_writepages(struct address_space *mapping, bool done = false, scanned = false, range_whole = false; pgoff_t end, index; struct cifs_writedata *wdata; + struct TCP_Server_Info *server; struct page *page; int rc = 0; @@ -1897,7 +1898,8 @@ retry: break; } wdata->pid = wdata->cfile->pid; - rc = cifs_async_writev(wdata); + server = tlink_tcon(wdata->cfile->tlink)->ses->server; + rc = server->ops->async_writev(wdata); } while (wbc->sync_mode == WB_SYNC_ALL && rc == -EAGAIN); for (i = 0; i < nr_pages; ++i) @@ -2228,6 +2230,9 @@ static int cifs_uncached_retry_writev(struct cifs_writedata *wdata) { int rc; + struct TCP_Server_Info *server; + + server = tlink_tcon(wdata->cfile->tlink)->ses->server; do { if (wdata->cfile->invalidHandle) { @@ -2235,7 +2240,7 @@ cifs_uncached_retry_writev(struct cifs_writedata *wdata) if (rc != 0) continue; } - rc = cifs_async_writev(wdata); + rc = server->ops->async_writev(wdata); } while (rc == -EAGAIN); return rc; @@ -2270,6 +2275,10 @@ cifs_iovec_write(struct file *file, const struct iovec *iov, cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); open_file = file->private_data; tcon = tlink_tcon(open_file->tlink); + + if (!tcon->ses->server->ops->async_writev) + return -ENOSYS; + offset = *poffset; if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index e2dbd22..50c3697 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -786,6 +786,7 @@ struct smb_version_operations smb1_operations = { .close = cifs_close_file, .flush = cifs_flush_file, .async_readv = cifs_async_readv, + .async_writev = cifs_async_writev, }; struct smb_version_values smb1_values = {