cifs: eliminate pfile pointer from cifsFileInfo
authorJeff Layton <jlayton@redhat.com>
Fri, 15 Oct 2010 19:34:01 +0000 (15:34 -0400)
committerSteve French <sfrench@us.ibm.com>
Mon, 18 Oct 2010 01:07:20 +0000 (01:07 +0000)
All the remaining users of cifsFileInfo->pfile just use it to get
at the f_flags/f_mode. Now that we store that separately in the
cifsFileInfo, there's no need to consult the pfile at all from
a cifsFileInfo pointer.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/cifsglob.h
fs/cifs/dir.c
fs/cifs/file.c

index b746dec88396e840cef1d847ecaeba00ecb149f0..9f99afab9a04692f05afe843959b893639c2cd42 100644 (file)
@@ -388,7 +388,6 @@ struct cifsFileInfo {
        __u16 netfid;           /* file id from remote */
        /* BB add lock scope info here if needed */ ;
        /* lock scope id (0 if none) */
-       struct file *pfile; /* needed for writepage */
        struct dentry *dentry;
        unsigned int f_flags;
        struct tcon_link *tlink;
index 3c23d882a44c3ec2abade234a9962b6fd9e28456..600eac18cb21242bffd599fe106fa0adb971c2f0 100644 (file)
@@ -148,7 +148,6 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file,
        pCifsFile->uid = current_fsuid();
        pCifsFile->dentry = dget(dentry);
        pCifsFile->f_flags = file->f_flags;
-       pCifsFile->pfile = file;
        pCifsFile->invalidHandle = false;
        pCifsFile->closePend = false;
        pCifsFile->tlink = cifs_get_tlink(tlink);
index d5f3007364e39c7444a56f58d764d68aa62f39ff..7935816fa1115d9ce4be3809c2289cf0b36dc311 100644 (file)
@@ -1144,8 +1144,7 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode,
                        continue;
                if (fsuid_only && open_file->uid != current_fsuid())
                        continue;
-               if (open_file->pfile && ((open_file->pfile->f_flags & O_RDWR) ||
-                   (open_file->pfile->f_flags & O_RDONLY))) {
+               if (OPEN_FMODE(open_file->f_flags) & FMODE_READ) {
                        if (!open_file->invalidHandle) {
                                /* found a good file */
                                /* lock it so it will not be closed on us */
@@ -1194,9 +1193,7 @@ refind_writable:
                        continue;
                if (fsuid_only && open_file->uid != current_fsuid())
                        continue;
-               if (open_file->pfile &&
-                   ((open_file->pfile->f_flags & O_RDWR) ||
-                    (open_file->pfile->f_flags & O_WRONLY))) {
+               if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
                        cifsFileInfo_get(open_file);
 
                        if (!open_file->invalidHandle) {
@@ -2160,9 +2157,7 @@ static int is_inode_writable(struct cifsInodeInfo *cifs_inode)
        list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
                if (open_file->closePend)
                        continue;
-               if (open_file->pfile &&
-                   ((open_file->pfile->f_flags & O_RDWR) ||
-                    (open_file->pfile->f_flags & O_WRONLY))) {
+               if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
                        read_unlock(&GlobalSMBSeslock);
                        return 1;
                }