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

Commit b1e6a015 authored by Nick Piggin's avatar Nick Piggin
Browse files

fs: change d_hash for rcu-walk



Change d_hash so it may be called from lock-free RCU lookups. See similar
patch for d_compare for details.

For in-tree filesystems, this is just a mechanical change.

Signed-off-by: default avatarNick Piggin <npiggin@kernel.dk>
parent 621e155a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -10,7 +10,8 @@ be able to use diff(1).
--------------------------- dentry_operations --------------------------
prototypes:
	int (*d_revalidate)(struct dentry *, int);
	int (*d_hash) (struct dentry *, struct qstr *);
	int (*d_hash)(const struct dentry *, const struct inode *,
			struct qstr *);
	int (*d_compare)(const struct dentry *, const struct inode *,
			const struct dentry *, const struct inode *,
			unsigned int, const char *, const struct qstr *);
@@ -22,7 +23,7 @@ prototypes:
locking rules:
		dcache_lock	rename_lock	->d_lock	may block
d_revalidate:	no		no		no		yes
d_hash		no		no		no		yes
d_hash		no		no		no		no
d_compare:	no		yes		no		no 
d_delete:	yes		no		yes		no
d_release:	no		no		no		yes
+7 −0
Original line number Diff line number Diff line
@@ -333,3 +333,10 @@ unreferenced dentries, and is now only called when the dentry refcount goes to
	.d_compare() calling convention and locking rules are significantly
changed. Read updated documentation in Documentation/filesystems/vfs.txt (and
look at examples of other filesystems) for guidance.

---
[mandatory]

	.d_hash() calling convention and locking rules are significantly
changed. Read updated documentation in Documentation/filesystems/vfs.txt (and
look at examples of other filesystems) for guidance.
+6 −2
Original line number Diff line number Diff line
@@ -847,7 +847,8 @@ defined:

struct dentry_operations {
	int (*d_revalidate)(struct dentry *, struct nameidata *);
	int (*d_hash)(struct dentry *, struct qstr *);
	int (*d_hash)(const struct dentry *, const struct inode *,
			struct qstr *);
	int (*d_compare)(const struct dentry *, const struct inode *,
			const struct dentry *, const struct inode *,
			unsigned int, const char *, const struct qstr *);
@@ -864,7 +865,10 @@ struct dentry_operations {

  d_hash: called when the VFS adds a dentry to the hash table. The first
	dentry passed to d_hash is the parent directory that the name is
	to be hashed into.
	to be hashed into. The inode is the dentry's inode.

	Same locking and synchronisation rules as d_compare regarding
	what is safe to dereference etc.

  d_compare: called to compare a dentry name with a given name. The first
	dentry is the parent of the dentry to be compared, the second is
+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ smb_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
	qname->hash = full_name_hash(qname->name, qname->len);

	if (dentry->d_op && dentry->d_op->d_hash)
		if (dentry->d_op->d_hash(dentry, qname) != 0)
		if (dentry->d_op->d_hash(dentry, inode, qname) != 0)
			goto end_advance;

	newdent = d_lookup(dentry, qname);
+4 −2
Original line number Diff line number Diff line
@@ -274,7 +274,8 @@ smb_dir_open(struct inode *dir, struct file *file)
 * Dentry operations routines
 */
static int smb_lookup_validate(struct dentry *, struct nameidata *);
static int smb_hash_dentry(struct dentry *, struct qstr *);
static int smb_hash_dentry(const struct dentry *, const struct inode *,
		struct qstr *);
static int smb_compare_dentry(const struct dentry *,
		const struct inode *,
		const struct dentry *, const struct inode *,
@@ -336,7 +337,8 @@ smb_lookup_validate(struct dentry * dentry, struct nameidata *nd)
}

static int 
smb_hash_dentry(struct dentry *dir, struct qstr *this)
smb_hash_dentry(const struct dentry *dir, const struct inode *inode,
		struct qstr *this)
{
	unsigned long hash;
	int i;
Loading