From patchwork Fri Oct 8 17:31:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 241961 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 o98Hd8Gk024801 for ; Fri, 8 Oct 2010 17:39:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759042Ab0JHRjJ (ORCPT ); Fri, 8 Oct 2010 13:39:09 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.122]:40348 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759034Ab0JHRjI (ORCPT ); Fri, 8 Oct 2010 13:39:08 -0400 X-Authority-Analysis: v=1.1 cv=tl/FS04gSkLncqxOIKBEYmN/gODDJX05BQMXZ5l6AuI= c=1 sm=0 a=grs7oj2nXSQA:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=VnNF1IyMAAAA:8 a=4tM_4paE0woP4F-CjykA:9 a=4WN93MiBxis4b77ZIawA:7 a=bOM6pzqgDaB8RptwMv5OGpgcK4YA:4 a=jEp0ucaQiEUA:10 a=0kPLrQdw3YYA:10 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:36931] helo=mail.poochiereds.net) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id E2/06-19342-A375FAC4; Fri, 08 Oct 2010 17:39:07 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 52FB05818A; Fri, 8 Oct 2010 13:31:13 -0400 (EDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH 09/15] cifs: move cifs_new_fileinfo to file.c Date: Fri, 8 Oct 2010 13:31:06 -0400 Message-Id: <1286559072-29032-10-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1286559072-29032-1-git-send-email-jlayton@redhat.com> References: <1286559072-29032-1-git-send-email-jlayton@redhat.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]); Fri, 08 Oct 2010 17:39:11 +0000 (UTC) diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 0ad8eef..983c483 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -130,50 +130,6 @@ cifs_bp_rename_retry: return full_path; } -struct cifsFileInfo * -cifs_new_fileinfo(__u16 fileHandle, struct file *file, - struct tcon_link *tlink, __u32 oplock) -{ - struct dentry *dentry = file->f_path.dentry; - struct inode *inode = dentry->d_inode; - struct cifsInodeInfo *pCifsInode = CIFS_I(inode); - struct cifsFileInfo *pCifsFile; - - pCifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); - if (pCifsFile == NULL) - return pCifsFile; - - pCifsFile->netfid = fileHandle; - pCifsFile->pid = current->tgid; - pCifsFile->uid = current_fsuid(); - pCifsFile->dentry = dget(dentry); - pCifsFile->f_flags = file->f_flags; - pCifsFile->invalidHandle = false; - pCifsFile->closePend = false; - pCifsFile->tlink = cifs_get_tlink(tlink); - mutex_init(&pCifsFile->fh_mutex); - mutex_init(&pCifsFile->lock_mutex); - INIT_LIST_HEAD(&pCifsFile->llist); - atomic_set(&pCifsFile->count, 1); - INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); - - write_lock(&GlobalSMBSeslock); - list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); - list_add(&pCifsFile->flist, &pCifsInode->openFileList); - write_unlock(&GlobalSMBSeslock); - - if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { - pCifsInode->clientCanCacheAll = true; - pCifsInode->clientCanCacheRead = true; - cFYI(1, "Exclusive Oplock inode %p", inode); - } else if ((oplock & 0xF) == OPLOCK_READ) - pCifsInode->clientCanCacheRead = true; - - file->private_data = pCifsFile; - - return pCifsFile; -} - int cifs_posix_open(char *full_path, struct inode **pinode, struct super_block *sb, int mode, int oflags, __u32 *poplock, __u16 *pnetfid, int xid) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 83e16d6..86a1597 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -159,6 +159,49 @@ client_can_cache: return rc; } +struct cifsFileInfo * +cifs_new_fileinfo(__u16 fileHandle, struct file *file, + struct tcon_link *tlink, __u32 oplock) +{ + struct dentry *dentry = file->f_path.dentry; + struct inode *inode = dentry->d_inode; + struct cifsInodeInfo *pCifsInode = CIFS_I(inode); + struct cifsFileInfo *pCifsFile; + + pCifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); + if (pCifsFile == NULL) + return pCifsFile; + + pCifsFile->netfid = fileHandle; + pCifsFile->pid = current->tgid; + pCifsFile->uid = current_fsuid(); + pCifsFile->dentry = dget(dentry); + pCifsFile->f_flags = file->f_flags; + pCifsFile->invalidHandle = false; + pCifsFile->closePend = false; + pCifsFile->tlink = cifs_get_tlink(tlink); + mutex_init(&pCifsFile->fh_mutex); + mutex_init(&pCifsFile->lock_mutex); + INIT_LIST_HEAD(&pCifsFile->llist); + atomic_set(&pCifsFile->count, 1); + INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); + + write_lock(&GlobalSMBSeslock); + list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); + list_add(&pCifsFile->flist, &pCifsInode->openFileList); + write_unlock(&GlobalSMBSeslock); + + if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { + pCifsInode->clientCanCacheAll = true; + pCifsInode->clientCanCacheRead = true; + cFYI(1, "Exclusive Oplock inode %p", inode); + } else if ((oplock & 0xF) == OPLOCK_READ) + pCifsInode->clientCanCacheRead = true; + + file->private_data = pCifsFile; + return pCifsFile; +} + int cifs_open(struct inode *inode, struct file *file) { int rc = -EACCES;