Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fceef393 authored by Al Viro's avatar Al Viro
Browse files

switch ->get_link() to delayed_call, kill ->put_link()



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent cd3417c8
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -51,7 +51,6 @@ prototypes:
			struct inode *, struct dentry *, unsigned int);
			struct inode *, struct dentry *, unsigned int);
	int (*readlink) (struct dentry *, char __user *,int);
	int (*readlink) (struct dentry *, char __user *,int);
	const char *(*get_link) (struct dentry *, struct inode *, void **);
	const char *(*get_link) (struct dentry *, struct inode *, void **);
	void (*put_link) (struct inode *, void *);
	void (*truncate) (struct inode *);
	void (*truncate) (struct inode *);
	int (*permission) (struct inode *, int, unsigned int);
	int (*permission) (struct inode *, int, unsigned int);
	int (*get_acl)(struct inode *, int);
	int (*get_acl)(struct inode *, int);
@@ -84,7 +83,6 @@ rename: yes (all) (see below)
rename2:	yes (all)	(see below)
rename2:	yes (all)	(see below)
readlink:	no
readlink:	no
get_link:	no
get_link:	no
put_link:	no
setattr:	yes
setattr:	yes
permission:	no (may not block if called in rcu-walk mode)
permission:	no (may not block if called in rcu-walk mode)
get_acl:	no
get_acl:	no
+6 −0
Original line number Original line Diff line number Diff line
@@ -515,3 +515,9 @@ in your dentry operations instead.
		* ->get_link() gets inode as a separate argument
		* ->get_link() gets inode as a separate argument
		* ->get_link() may be called in RCU mode - in that case NULL
		* ->get_link() may be called in RCU mode - in that case NULL
		  dentry is passed
		  dentry is passed
--
[mandatory]
	->get_link() gets struct delayed_call *done now, and should do
	set_delayed_call() where it used to set *cookie.
	->put_link() is gone - just give the destructor to set_delayed_call()
	in ->get_link().
+10 −11
Original line number Original line Diff line number Diff line
@@ -350,8 +350,8 @@ struct inode_operations {
	int (*rename2) (struct inode *, struct dentry *,
	int (*rename2) (struct inode *, struct dentry *,
			struct inode *, struct dentry *, unsigned int);
			struct inode *, struct dentry *, unsigned int);
	int (*readlink) (struct dentry *, char __user *,int);
	int (*readlink) (struct dentry *, char __user *,int);
	const char *(*follow_link) (struct dentry *, void **);
	const char *(*get_link) (struct dentry *, struct inode *,
	void (*put_link) (struct inode *, void *);
				 struct delayed_call *);
	int (*permission) (struct inode *, int);
	int (*permission) (struct inode *, int);
	int (*get_acl)(struct inode *, int);
	int (*get_acl)(struct inode *, int);
	int (*setattr) (struct dentry *, struct iattr *);
	int (*setattr) (struct dentry *, struct iattr *);
@@ -434,20 +434,19 @@ otherwise noted.
  readlink: called by the readlink(2) system call. Only required if
  readlink: called by the readlink(2) system call. Only required if
	you want to support reading symbolic links
	you want to support reading symbolic links


  follow_link: called by the VFS to follow a symbolic link to the
  get_link: called by the VFS to follow a symbolic link to the
	inode it points to.  Only required if you want to support
	inode it points to.  Only required if you want to support
	symbolic links.  This method returns the symlink body
	symbolic links.  This method returns the symlink body
	to traverse (and possibly resets the current position with
	to traverse (and possibly resets the current position with
	nd_jump_link()).  If the body won't go away until the inode
	nd_jump_link()).  If the body won't go away until the inode
	is gone, nothing else is needed; if it needs to be otherwise
	is gone, nothing else is needed; if it needs to be otherwise
	pinned, the data needed to release whatever we'd grabbed
	pinned, arrange for its release by having get_link(..., ..., done)
	is to be stored in void * variable passed by address to
	do set_delayed_call(done, destructor, argument).
	follow_link() instance.
	In that case destructor(argument) will be called once VFS is

	done with the body you've returned.
  put_link: called by the VFS to release resources allocated by
	May be called in RCU mode; that is indicated by NULL dentry
	follow_link().  The cookie stored by follow_link() is passed
	argument.  If request can't be handled without leaving RCU mode,
	to this method as the last parameter; only called when
	have it return ERR_PTR(-ECHILD).
	cookie isn't NULL.


  permission: called by the VFS to check for access rights on a POSIX-like
  permission: called by the VFS to check for access rights on a POSIX-like
  	filesystem.
  	filesystem.
+9 −9
Original line number Original line Diff line number Diff line
@@ -118,8 +118,14 @@ static int ll_readlink_internal(struct inode *inode,
	return rc;
	return rc;
}
}


static void ll_put_link(void *p)
{
	ptlrpc_req_finished(p);
}

static const char *ll_get_link(struct dentry *dentry,
static const char *ll_get_link(struct dentry *dentry,
			       struct inode *inode, void **cookie)
			       struct inode *inode,
			       struct delayed_call *done)
{
{
	struct ptlrpc_request *request = NULL;
	struct ptlrpc_request *request = NULL;
	int rc;
	int rc;
@@ -137,22 +143,16 @@ static const char *ll_get_link(struct dentry *dentry,
	}
	}


	/* symname may contain a pointer to the request message buffer,
	/* symname may contain a pointer to the request message buffer,
	 * we delay request releasing until ll_put_link then.
	 * we delay request releasing then.
	 */
	 */
	*cookie = request;
	set_delayed_call(done, ll_put_link, request);
	return symname;
	return symname;
}
}


static void ll_put_link(struct inode *unused, void *cookie)
{
	ptlrpc_req_finished(cookie);
}

struct inode_operations ll_fast_symlink_inode_operations = {
struct inode_operations ll_fast_symlink_inode_operations = {
	.readlink	= generic_readlink,
	.readlink	= generic_readlink,
	.setattr	= ll_setattr,
	.setattr	= ll_setattr,
	.get_link	= ll_get_link,
	.get_link	= ll_get_link,
	.put_link	= ll_put_link,
	.getattr	= ll_getattr,
	.getattr	= ll_getattr,
	.permission	= ll_inode_permission,
	.permission	= ll_inode_permission,
	.setxattr	= ll_setxattr,
	.setxattr	= ll_setxattr,
+5 −4
Original line number Original line Diff line number Diff line
@@ -1226,11 +1226,12 @@ ino_t v9fs_qid2ino(struct p9_qid *qid)
 * v9fs_vfs_get_link - follow a symlink path
 * v9fs_vfs_get_link - follow a symlink path
 * @dentry: dentry for symlink
 * @dentry: dentry for symlink
 * @inode: inode for symlink
 * @inode: inode for symlink
 * @cookie: place to pass the data to put_link()
 * @done: delayed call for when we are done with the return value
 */
 */


static const char *v9fs_vfs_get_link(struct dentry *dentry,
static const char *v9fs_vfs_get_link(struct dentry *dentry,
				     struct inode *inode, void **cookie)
				     struct inode *inode,
				     struct delayed_call *done)
{
{
	struct v9fs_session_info *v9ses;
	struct v9fs_session_info *v9ses;
	struct p9_fid *fid;
	struct p9_fid *fid;
@@ -1266,7 +1267,8 @@ static const char *v9fs_vfs_get_link(struct dentry *dentry,


	p9stat_free(st);
	p9stat_free(st);
	kfree(st);
	kfree(st);
	return *cookie = res;
	set_delayed_call(done, kfree_link, res);
	return res;
}
}


/**
/**
@@ -1460,7 +1462,6 @@ static const struct inode_operations v9fs_file_inode_operations = {
static const struct inode_operations v9fs_symlink_inode_operations = {
static const struct inode_operations v9fs_symlink_inode_operations = {
	.readlink = generic_readlink,
	.readlink = generic_readlink,
	.get_link = v9fs_vfs_get_link,
	.get_link = v9fs_vfs_get_link,
	.put_link = kfree_put_link,
	.getattr = v9fs_vfs_getattr,
	.getattr = v9fs_vfs_getattr,
	.setattr = v9fs_vfs_setattr,
	.setattr = v9fs_vfs_setattr,
};
};
Loading