Skip to content

Commit cb7ec76

Browse files
committed
NFSD: nfsd_file_hash_remove can compute hashval
Remove an unnecessary use of nf_hashval. Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent a845511 commit cb7ec76

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

fs/nfsd/filecache.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,18 @@ nfsd_file_do_unhash(struct nfsd_file *nf)
288288
atomic_long_dec(&nfsd_filecache_count);
289289
}
290290

291+
static void
292+
nfsd_file_hash_remove(struct nfsd_file *nf)
293+
{
294+
struct inode *inode = nf->nf_inode;
295+
unsigned int hashval = (unsigned int)hash_long(inode->i_ino,
296+
NFSD_FILE_HASH_BITS);
297+
298+
spin_lock(&nfsd_file_hashtbl[hashval].nfb_lock);
299+
nfsd_file_do_unhash(nf);
300+
spin_unlock(&nfsd_file_hashtbl[hashval].nfb_lock);
301+
}
302+
291303
static bool
292304
nfsd_file_unhash(struct nfsd_file *nf)
293305
{
@@ -507,11 +519,8 @@ static void nfsd_file_gc_dispose_list(struct list_head *dispose)
507519
{
508520
struct nfsd_file *nf;
509521

510-
list_for_each_entry(nf, dispose, nf_lru) {
511-
spin_lock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock);
512-
nfsd_file_do_unhash(nf);
513-
spin_unlock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock);
514-
}
522+
list_for_each_entry(nf, dispose, nf_lru)
523+
nfsd_file_hash_remove(nf);
515524
nfsd_file_dispose_list_delayed(dispose);
516525
}
517526

0 commit comments

Comments
 (0)