Skip to content

Commit fceef39

Browse files
author
Al Viro
committed
switch ->get_link() to delayed_call, kill ->put_link()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent cd3417c commit fceef39

File tree

43 files changed

+206
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+206
-218
lines changed

Documentation/filesystems/Locking

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ prototypes:
5151
struct inode *, struct dentry *, unsigned int);
5252
int (*readlink) (struct dentry *, char __user *,int);
5353
const char *(*get_link) (struct dentry *, struct inode *, void **);
54-
void (*put_link) (struct inode *, void *);
5554
void (*truncate) (struct inode *);
5655
int (*permission) (struct inode *, int, unsigned int);
5756
int (*get_acl)(struct inode *, int);
@@ -84,7 +83,6 @@ rename: yes (all) (see below)
8483
rename2: yes (all) (see below)
8584
readlink: no
8685
get_link: no
87-
put_link: no
8886
setattr: yes
8987
permission: no (may not block if called in rcu-walk mode)
9088
get_acl: no

Documentation/filesystems/porting

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,3 +515,9 @@ in your dentry operations instead.
515515
* ->get_link() gets inode as a separate argument
516516
* ->get_link() may be called in RCU mode - in that case NULL
517517
dentry is passed
518+
--
519+
[mandatory]
520+
->get_link() gets struct delayed_call *done now, and should do
521+
set_delayed_call() where it used to set *cookie.
522+
->put_link() is gone - just give the destructor to set_delayed_call()
523+
in ->get_link().

Documentation/filesystems/vfs.txt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ struct inode_operations {
350350
int (*rename2) (struct inode *, struct dentry *,
351351
struct inode *, struct dentry *, unsigned int);
352352
int (*readlink) (struct dentry *, char __user *,int);
353-
const char *(*follow_link) (struct dentry *, void **);
354-
void (*put_link) (struct inode *, void *);
353+
const char *(*get_link) (struct dentry *, struct inode *,
354+
struct delayed_call *);
355355
int (*permission) (struct inode *, int);
356356
int (*get_acl)(struct inode *, int);
357357
int (*setattr) (struct dentry *, struct iattr *);
@@ -434,20 +434,19 @@ otherwise noted.
434434
readlink: called by the readlink(2) system call. Only required if
435435
you want to support reading symbolic links
436436

437-
follow_link: called by the VFS to follow a symbolic link to the
437+
get_link: called by the VFS to follow a symbolic link to the
438438
inode it points to. Only required if you want to support
439439
symbolic links. This method returns the symlink body
440440
to traverse (and possibly resets the current position with
441441
nd_jump_link()). If the body won't go away until the inode
442442
is gone, nothing else is needed; if it needs to be otherwise
443-
pinned, the data needed to release whatever we'd grabbed
444-
is to be stored in void * variable passed by address to
445-
follow_link() instance.
446-
447-
put_link: called by the VFS to release resources allocated by
448-
follow_link(). The cookie stored by follow_link() is passed
449-
to this method as the last parameter; only called when
450-
cookie isn't NULL.
443+
pinned, arrange for its release by having get_link(..., ..., done)
444+
do set_delayed_call(done, destructor, argument).
445+
In that case destructor(argument) will be called once VFS is
446+
done with the body you've returned.
447+
May be called in RCU mode; that is indicated by NULL dentry
448+
argument. If request can't be handled without leaving RCU mode,
449+
have it return ERR_PTR(-ECHILD).
451450

452451
permission: called by the VFS to check for access rights on a POSIX-like
453452
filesystem.

drivers/staging/lustre/lustre/llite/symlink.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,14 @@ static int ll_readlink_internal(struct inode *inode,
118118
return rc;
119119
}
120120

121+
static void ll_put_link(void *p)
122+
{
123+
ptlrpc_req_finished(p);
124+
}
125+
121126
static const char *ll_get_link(struct dentry *dentry,
122-
struct inode *inode, void **cookie)
127+
struct inode *inode,
128+
struct delayed_call *done)
123129
{
124130
struct ptlrpc_request *request = NULL;
125131
int rc;
@@ -137,22 +143,16 @@ static const char *ll_get_link(struct dentry *dentry,
137143
}
138144

139145
/* symname may contain a pointer to the request message buffer,
140-
* we delay request releasing until ll_put_link then.
146+
* we delay request releasing then.
141147
*/
142-
*cookie = request;
148+
set_delayed_call(done, ll_put_link, request);
143149
return symname;
144150
}
145151

146-
static void ll_put_link(struct inode *unused, void *cookie)
147-
{
148-
ptlrpc_req_finished(cookie);
149-
}
150-
151152
struct inode_operations ll_fast_symlink_inode_operations = {
152153
.readlink = generic_readlink,
153154
.setattr = ll_setattr,
154155
.get_link = ll_get_link,
155-
.put_link = ll_put_link,
156156
.getattr = ll_getattr,
157157
.permission = ll_inode_permission,
158158
.setxattr = ll_setxattr,

fs/9p/vfs_inode.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,11 +1226,12 @@ ino_t v9fs_qid2ino(struct p9_qid *qid)
12261226
* v9fs_vfs_get_link - follow a symlink path
12271227
* @dentry: dentry for symlink
12281228
* @inode: inode for symlink
1229-
* @cookie: place to pass the data to put_link()
1229+
* @done: delayed call for when we are done with the return value
12301230
*/
12311231

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

12671268
p9stat_free(st);
12681269
kfree(st);
1269-
return *cookie = res;
1270+
set_delayed_call(done, kfree_link, res);
1271+
return res;
12701272
}
12711273

12721274
/**
@@ -1460,7 +1462,6 @@ static const struct inode_operations v9fs_file_inode_operations = {
14601462
static const struct inode_operations v9fs_symlink_inode_operations = {
14611463
.readlink = generic_readlink,
14621464
.get_link = v9fs_vfs_get_link,
1463-
.put_link = kfree_put_link,
14641465
.getattr = v9fs_vfs_getattr,
14651466
.setattr = v9fs_vfs_setattr,
14661467
};

fs/9p/vfs_inode_dotl.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,12 +902,13 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
902902
* v9fs_vfs_get_link_dotl - follow a symlink path
903903
* @dentry: dentry for symlink
904904
* @inode: inode for symlink
905-
* @cookie: place to pass the data to put_link()
905+
* @done: destructor for return value
906906
*/
907907

908908
static const char *
909909
v9fs_vfs_get_link_dotl(struct dentry *dentry,
910-
struct inode *inode, void **cookie)
910+
struct inode *inode,
911+
struct delayed_call *done)
911912
{
912913
struct p9_fid *fid;
913914
char *target;
@@ -924,7 +925,8 @@ v9fs_vfs_get_link_dotl(struct dentry *dentry,
924925
retval = p9_client_readlink(fid, &target);
925926
if (retval)
926927
return ERR_PTR(retval);
927-
return *cookie = target;
928+
set_delayed_call(done, kfree_link, target);
929+
return target;
928930
}
929931

930932
int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
@@ -991,7 +993,6 @@ const struct inode_operations v9fs_file_inode_operations_dotl = {
991993
const struct inode_operations v9fs_symlink_inode_operations_dotl = {
992994
.readlink = generic_readlink,
993995
.get_link = v9fs_vfs_get_link_dotl,
994-
.put_link = kfree_put_link,
995996
.getattr = v9fs_vfs_getattr_dotl,
996997
.setattr = v9fs_vfs_setattr_dotl,
997998
.setxattr = generic_setxattr,

fs/affs/symlink.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,5 @@ const struct address_space_operations affs_symlink_aops = {
7272
const struct inode_operations affs_symlink_inode_operations = {
7373
.readlink = generic_readlink,
7474
.get_link = page_get_link,
75-
.put_link = page_put_link,
7675
.setattr = affs_notify_change,
7776
};

fs/autofs4/symlink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
#include "autofs_i.h"
1414

1515
static const char *autofs4_get_link(struct dentry *dentry,
16-
struct inode *inode, void **cookie)
16+
struct inode *inode,
17+
struct delayed_call *done)
1718
{
1819
struct autofs_sb_info *sbi;
1920
struct autofs_info *ino;

fs/btrfs/inode.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10097,7 +10097,6 @@ static const struct inode_operations btrfs_special_inode_operations = {
1009710097
static const struct inode_operations btrfs_symlink_inode_operations = {
1009810098
.readlink = generic_readlink,
1009910099
.get_link = page_get_link,
10100-
.put_link = page_put_link,
1010110100
.getattr = btrfs_getattr,
1010210101
.setattr = btrfs_setattr,
1010310102
.permission = btrfs_permission,

fs/cifs/cifsfs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,6 @@ const struct inode_operations cifs_file_inode_ops = {
901901
const struct inode_operations cifs_symlink_inode_ops = {
902902
.readlink = generic_readlink,
903903
.get_link = cifs_get_link,
904-
.put_link = kfree_put_link,
905904
.permission = cifs_permission,
906905
/* BB add the following two eventually */
907906
/* revalidate: cifs_revalidate,

0 commit comments

Comments
 (0)