From patchwork Tue Mar 31 20:09:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 15496 Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2VK9pJt008240 for ; Tue, 31 Mar 2009 20:09:51 GMT Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 9204E163CCF for ; Tue, 31 Mar 2009 20:09:33 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on dp.samba.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=3.8 tests=AWL,BAYES_00, FORGED_RCVD_HELO,RCVD_IN_SORBS_WEB autolearn=no version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mail.etersoft.ru (mail.etersoft.ru [87.249.47.46]) by lists.samba.org (Postfix) with ESMTP id D4798163BE9 for ; Tue, 31 Mar 2009 20:09:07 +0000 (GMT) Received: from localhost (as.office.etersoft.ru [192.168.0.10]) by mail.etersoft.ru (Postfix) with ESMTP id B07C13039CE for ; Wed, 1 Apr 2009 00:09:23 +0400 (MSD) X-Virus-Scanned: amavisd-new at office.etersoft.ru Received: from mail.etersoft.ru ([192.168.0.1]) by localhost (as.office.etersoft.ru [192.168.0.10]) (amavisd-new, port 10024) with LMTP id BFkYWPNiVYbo for ; Wed, 1 Apr 2009 00:09:18 +0400 (MSD) Received: from homestation.localnet (pppoe-88-147-209-216.san.ru [88.147.209.216]) by mail.etersoft.ru (Postfix) with ESMTP id DFE5C2F9B1C for ; Wed, 1 Apr 2009 00:09:18 +0400 (MSD) From: Pavel Shilovsky To: linux-cifs-client@lists.samba.org Subject: Re: [linux-cifs-client] [PATCH] non-direct reading Date: Wed, 1 Apr 2009 00:09:17 +0400 User-Agent: KMail/1.10.3 (Linux/2.6.26-1-686; KDE/4.1.3; i686; ; ) References: <49D218F1.3080006@etersoft.ru> <200903312103.30771.piastry@etersoft.ru> In-Reply-To: <200903312103.30771.piastry@etersoft.ru> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200904010009.17556.piastry@etersoft.ru> X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Errors-To: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org I found bug in my patch, Here is right variant. diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 3ae62fb..6525661 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -622,6 +622,23 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, return written; } +static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov, + unsigned long nr_segs, loff_t pos) +{ + struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; + ssize_t read; + + if (CIFS_I(inode)->clientCanCacheRead) + read = generic_file_aio_read(iocb, iov, nr_segs, pos); + else { + read = cifs_user_read(iocb->ki_filp, iov->iov_base, + iov->iov_len, &pos); + iocb->ki_pos = pos; + } + return read; +} + + static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) { /* origin == SEEK_END => we must revalidate the cached file length */ @@ -733,7 +750,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,