From patchwork Tue Nov 2 19:44:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 297962 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA2JivSf026013 for ; Tue, 2 Nov 2010 19:44:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755164Ab0KBTo6 (ORCPT ); Tue, 2 Nov 2010 15:44:58 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:56096 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755106Ab0KBTo6 (ORCPT ); Tue, 2 Nov 2010 15:44:58 -0400 Received: by eye27 with SMTP id 27so4167853eye.19 for ; Tue, 02 Nov 2010 12:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:x-mailer:in-reply-to:references; bh=bskCjG3Lk3ZTtei5U0SztT+0cDhQwT0mv8eXBeTkIJM=; b=rnTzjIX9R0/05wG2SnDsodMdfRcu5eB4IWLRBLLxWzEfvs2kVT2jxTj4zOy86yUMYv LUJTOzye13XGstzgTW0ZbwFuVRAo8RXwPXxSWPDeYK4ewKjnxN3pD1a0SUAt5uMZlxmz GfTEzqvmEOAENdDuMF62InslQxfeGq9eGwTfs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; b=UlCmBJ3zL9rupDQWz6wF4q1FhzqLIan/H9BWQ+5MYtZWQcgo1PS964pw96GPhLmpll RKGjwJ4FFV52G9pgiPExe1X76fQyVoz2jTRi+iHJ4FXIIWhgHKdj6SKPshUgjB1DFryg 9o2phIJDVWP/NLgwg5QgaRbQUIYaz0rL2q16w= Received: by 10.213.112.133 with SMTP id w5mr3755158ebp.96.1288727096845; Tue, 02 Nov 2010 12:44:56 -0700 (PDT) Received: from localhost.localdomain ([95.84.33.166]) by mx.google.com with ESMTPS id w20sm5752673eeh.6.2010.11.02.12.44.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 02 Nov 2010 12:44:56 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 2/4] CIFS: New read logic Date: Tue, 2 Nov 2010 22:44:19 +0300 Message-Id: <1288727061-18759-2-git-send-email-piastryyy@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1288727061-18759-1-git-send-email-piastryyy@gmail.com> References: <1288727061-18759-1-git-send-email-piastryyy@gmail.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 02 Nov 2010 19:45:00 +0000 (UTC) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 38526a6..bb7f36e 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -569,6 +569,30 @@ cifs_do_mount(struct file_system_type *fs_type, return dget(sb->s_root); } +static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov, + unsigned long nr_segs, loff_t pos) +{ + struct inode *inode; + struct cifs_sb_info *cifs_sb; + ssize_t read; + + inode = iocb->ki_filp->f_path.dentry->d_inode; + cifs_sb = CIFS_SB(iocb->ki_filp->f_path.dentry->d_sb); + + if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) == 0) + /* BB call cifs_revalidate_file before generic_file_aio_read */ + return generic_file_aio_read(iocb, iov, nr_segs, pos); + + if (!CIFS_I(inode)->clientCanCacheRead) { + read = cifs_user_read(iocb->ki_filp, iov->iov_base, + iov->iov_len, &pos); + iocb->ki_pos = pos; + } else + read = generic_file_aio_read(iocb, iov, nr_segs, pos); + + return read; +} + static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos) { @@ -691,7 +715,7 @@ const struct inode_operations cifs_symlink_inode_ops = { const struct file_operations cifs_file_ops = { .read = do_sync_read, .write = do_sync_write, - .aio_read = generic_file_aio_read, + .aio_read = cifs_file_aio_read, .aio_write = cifs_file_aio_write, .open = cifs_open, .release = cifs_close, @@ -728,7 +752,7 @@ const struct file_operations cifs_file_direct_ops = { const struct file_operations cifs_file_nobrl_ops = { .read = do_sync_read, .write = do_sync_write, - .aio_read = generic_file_aio_read, + .aio_read = cifs_file_aio_read, .aio_write = cifs_file_aio_write, .open = cifs_open, .release = cifs_close,