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 Diff line number Diff line
@@ -51,7 +51,6 @@ prototypes:
			struct inode *, struct dentry *, unsigned int);
	int (*readlink) (struct dentry *, char __user *,int);
	const char *(*get_link) (struct dentry *, struct inode *, void **);
	void (*put_link) (struct inode *, void *);
	void (*truncate) (struct inode *);
	int (*permission) (struct inode *, int, unsigned int);
	int (*get_acl)(struct inode *, int);
@@ -84,7 +83,6 @@ rename: yes (all) (see below)
rename2:	yes (all)	(see below)
readlink:	no
get_link:	no
put_link:	no
setattr:	yes
permission:	no (may not block if called in rcu-walk mode)
get_acl:	no
+6 −0
Original line number Diff line number Diff line
@@ -515,3 +515,9 @@ in your dentry operations instead.
		* ->get_link() gets inode as a separate argument
		* ->get_link() may be called in RCU mode - in that case NULL
		  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 Diff line number Diff line
@@ -350,8 +350,8 @@ struct inode_operations {
	int (*rename2) (struct inode *, struct dentry *,
			struct inode *, struct dentry *, unsigned int);
	int (*readlink) (struct dentry *, char __user *,int);
	const char *(*follow_link) (struct dentry *, void **);
	void (*put_link) (struct inode *, void *);
	const char *(*get_link) (struct dentry *, struct inode *,
				 struct delayed_call *);
	int (*permission) (struct inode *, int);
	int (*get_acl)(struct inode *, int);
	int (*setattr) (struct dentry *, struct iattr *);
@@ -434,20 +434,19 @@ otherwise noted.
  readlink: called by the readlink(2) system call. Only required if
	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
	symbolic links.  This method returns the symlink body
	to traverse (and possibly resets the current position with
	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
	pinned, the data needed to release whatever we'd grabbed
	is to be stored in void * variable passed by address to
	follow_link() instance.

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

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

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

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;
	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,
	 * 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;
}

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

struct inode_operations ll_fast_symlink_inode_operations = {
	.readlink	= generic_readlink,
	.setattr	= ll_setattr,
	.get_link	= ll_get_link,
	.put_link	= ll_put_link,
	.getattr	= ll_getattr,
	.permission	= ll_inode_permission,
	.setxattr	= ll_setxattr,
+5 −4
Original line number 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
 * @dentry: dentry 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,
				     struct inode *inode, void **cookie)
				     struct inode *inode,
				     struct delayed_call *done)
{
	struct v9fs_session_info *v9ses;
	struct p9_fid *fid;
@@ -1266,7 +1267,8 @@ static const char *v9fs_vfs_get_link(struct dentry *dentry,

	p9stat_free(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 = {
	.readlink = generic_readlink,
	.get_link = v9fs_vfs_get_link,
	.put_link = kfree_put_link,
	.getattr = v9fs_vfs_getattr,
	.setattr = v9fs_vfs_setattr,
};
Loading