diff options
Diffstat (limited to 'fs/9p/vfs_inode.c')
| -rw-r--r-- | fs/9p/vfs_inode.c | 42 | 
1 files changed, 21 insertions, 21 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 94de6d1482e..7fa4f7a7653 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -147,7 +147,7 @@ static umode_t p9mode2unixmode(struct v9fs_session_info *v9ses,  		int major = -1, minor = -1;  		strlcpy(ext, stat->extension, sizeof(ext)); -		sscanf(ext, "%c %u %u", &type, &major, &minor); +		sscanf(ext, "%c %i %i", &type, &major, &minor);  		switch (type) {  		case 'c':  			res |= S_IFCHR; @@ -299,15 +299,22 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,  	case S_IFREG:  		if (v9fs_proto_dotl(v9ses)) {  			inode->i_op = &v9fs_file_inode_operations_dotl; -			if (v9ses->cache) +			if (v9ses->cache == CACHE_LOOSE || +			    v9ses->cache == CACHE_FSCACHE)  				inode->i_fop =  					&v9fs_cached_file_operations_dotl; +			else if (v9ses->cache == CACHE_MMAP) +				inode->i_fop = &v9fs_mmap_file_operations_dotl;  			else  				inode->i_fop = &v9fs_file_operations_dotl;  		} else {  			inode->i_op = &v9fs_file_inode_operations; -			if (v9ses->cache) -				inode->i_fop = &v9fs_cached_file_operations; +			if (v9ses->cache == CACHE_LOOSE || +			    v9ses->cache == CACHE_FSCACHE) +				inode->i_fop = +					&v9fs_cached_file_operations; +			else if (v9ses->cache == CACHE_MMAP) +				inode->i_fop = &v9fs_mmap_file_operations;  			else  				inode->i_fop = &v9fs_file_operations;  		} @@ -444,13 +451,11 @@ void v9fs_evict_inode(struct inode *inode)  {  	struct v9fs_inode *v9inode = V9FS_I(inode); -	truncate_inode_pages(inode->i_mapping, 0); +	truncate_inode_pages_final(inode->i_mapping);  	clear_inode(inode);  	filemap_fdatawrite(inode->i_mapping); -#ifdef CONFIG_9P_FSCACHE  	v9fs_cache_inode_put_cookie(inode); -#endif  	/* clunk the fid stashed in writeback_fid */  	if (v9inode->writeback_fid) {  		p9_client_clunk(v9inode->writeback_fid); @@ -531,9 +536,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,  		goto error;  	v9fs_stat2inode(st, inode, sb); -#ifdef CONFIG_9P_FSCACHE  	v9fs_cache_inode_get_cookie(inode); -#endif  	unlock_new_inode(inode);  	return inode;  error: @@ -577,7 +580,7 @@ static int v9fs_at_to_dotl_flags(int flags)   * v9fs_remove - helper function to remove files and directories   * @dir: directory inode that is being deleted   * @dentry:  dentry that is being deleted - * @rmdir: removing a directory + * @flags: removing a directory   *   */ @@ -775,7 +778,7 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode   * v9fs_vfs_lookup - VFS lookup hook to "walk" to a new inode   * @dir:  inode that is being walked from   * @dentry: dentry that is being walked to? - * @nameidata: path data + * @flags: lookup flags (unused)   *   */ @@ -783,7 +786,6 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,  				      unsigned int flags)  {  	struct dentry *res; -	struct super_block *sb;  	struct v9fs_session_info *v9ses;  	struct p9_fid *dfid, *fid;  	struct inode *inode; @@ -795,7 +797,6 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,  	if (dentry->d_name.len > NAME_MAX)  		return ERR_PTR(-ENAMETOOLONG); -	sb = dir->i_sb;  	v9ses = v9fs_inode2v9ses(dir);  	/* We can walk d_parent because we hold the dir->i_mutex */  	dfid = v9fs_fid_lookup(dentry->d_parent); @@ -816,7 +817,7 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,  	 * unlink. For cached mode create calls request for new  	 * inode. But with cache disabled, lookup should do this.  	 */ -	if (v9ses->cache) +	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)  		inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb);  	else  		inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); @@ -867,7 +868,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,  		return finish_no_open(file, res);  	err = 0; -	fid = NULL; +  	v9ses = v9fs_inode2v9ses(dir);  	perm = unixmode2p9mode(v9ses, mode);  	fid = v9fs_create(v9ses, dir, dentry, NULL, perm, @@ -882,7 +883,8 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,  	v9fs_invalidate_inode_attr(dir);  	v9inode = V9FS_I(dentry->d_inode);  	mutex_lock(&v9inode->v_mutex); -	if (v9ses->cache && !v9inode->writeback_fid && +	if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && +	    !v9inode->writeback_fid &&  	    ((flags & O_ACCMODE) != O_RDONLY)) {  		/*  		 * clone a fid and add it to writeback_fid @@ -905,10 +907,8 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,  		goto error;  	file->private_data = fid; -#ifdef CONFIG_9P_FSCACHE -	if (v9ses->cache) +	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)  		v9fs_cache_inode_set_cookie(dentry->d_inode, file); -#endif  	*opened |= FILE_CREATED;  out: @@ -1324,7 +1324,7 @@ v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)   * v9fs_vfs_mkspecial - create a special file   * @dir: inode to create special file in   * @dentry: dentry to create - * @mode: mode to create special file + * @perm: mode to create special file   * @extension: 9p2000.u format extension string representing special file   *   */ @@ -1485,7 +1485,7 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)  	 */  	i_size = inode->i_size;  	v9fs_stat2inode(st, inode, inode->i_sb); -	if (v9ses->cache) +	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)  		inode->i_size = i_size;  	spin_unlock(&inode->i_lock);  out:  | 
