return total_written;
 }
 
-static struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
+struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
 {
        struct cifsFileInfo *open_file;
+       int rc;
 
        read_lock(&GlobalSMBSeslock);
        list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
                     (open_file->pfile->f_flags & O_WRONLY))) {
                        read_unlock(&GlobalSMBSeslock);
                        if(open_file->invalidHandle) {
-                               rc = cifs_reopen_file(cifs_inode->vfs_inode, 
+                               rc = cifs_reopen_file(&cifs_inode->vfs_inode, 
                                                      open_file->pfile, FALSE);
                                /* if it fails, try another handle - might be */
                                /* dangerous to hold up writepages with retry */
 
        struct cifsTconInfo *pTcon;
        char *full_path = NULL;
        int rc = -EACCES;
-       int found = FALSE;
        struct cifsFileInfo *open_file = NULL;
        FILE_BASIC_INFO time_buf;
        int set_time = FALSE;
        __u64 uid = 0xFFFFFFFFFFFFFFFFULL;
        __u64 gid = 0xFFFFFFFFFFFFFFFFULL;
        struct cifsInodeInfo *cifsInode;
-       struct list_head *tmp;
 
        xid = GetXid();