From patchwork Mon Oct 11 19:07:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 246151 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 o9BJ7FUm003293 for ; Mon, 11 Oct 2010 19:07:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755233Ab0JKTHh (ORCPT ); Mon, 11 Oct 2010 15:07:37 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.121]:38357 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755315Ab0JKTHg (ORCPT ); Mon, 11 Oct 2010 15:07:36 -0400 X-Authority-Analysis: v=1.1 cv=QSZclhxgDhhmevwBV2YEn103LiRbjsuAJdvYsZfX8C8= c=1 sm=0 a=odzou3OSiVwA:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=VnNF1IyMAAAA:8 a=4tM_4paE0woP4F-CjykA:9 a=b4WfjvJtBimj9ksiJKkA: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:37722] helo=mail.poochiereds.net) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id 2B/66-23684-77063BC4; Mon, 11 Oct 2010 19:07:35 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 9D10258196; Mon, 11 Oct 2010 15:07:34 -0400 (EDT) From: Jeff Layton To: linux-cifs@vger.kernel.org Subject: [PATCH 10/16] cifs: move cifs_new_fileinfo to file.c Date: Mon, 11 Oct 2010 15:07:27 -0400 Message-Id: <1286824053-12084-11-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1286824053-12084-1-git-send-email-jlayton@redhat.com> References: <1286824053-12084-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]); Mon, 11 Oct 2010 19:07:39 +0000 (UTC) diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index c5fb312..3840edd 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; -} - static void setup_cifs_dentry(struct cifsTconInfo *tcon, struct dentry *direntry, struct inode *newinode) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 1eb9e40..422bb18 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -219,6 +219,49 @@ posix_open_ret: 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;