Skip to content

Commit 4d94c2e

Browse files
author
Christoph Hellwig
committed
nfsd: move nfsd_fh_match to nfsfh.h
The pnfs code will need it too. Also remove the nfsd_ prefix to match the other filehandle helpers in that file. Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 11afe9f commit 4d94c2e

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

fs/nfsd/nfs4state.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -398,14 +398,6 @@ static unsigned int file_hashval(struct knfsd_fh *fh)
398398
return nfsd_fh_hashval(fh) & (FILE_HASH_SIZE - 1);
399399
}
400400

401-
static bool nfsd_fh_match(struct knfsd_fh *fh1, struct knfsd_fh *fh2)
402-
{
403-
return fh1->fh_size == fh2->fh_size &&
404-
!memcmp(fh1->fh_base.fh_pad,
405-
fh2->fh_base.fh_pad,
406-
fh1->fh_size);
407-
}
408-
409401
static struct hlist_head file_hashtbl[FILE_HASH_SIZE];
410402

411403
static void
@@ -3295,7 +3287,7 @@ find_file_locked(struct knfsd_fh *fh, unsigned int hashval)
32953287
struct nfs4_file *fp;
32963288

32973289
hlist_for_each_entry_rcu(fp, &file_hashtbl[hashval], fi_hash) {
3298-
if (nfsd_fh_match(&fp->fi_fhandle, fh)) {
3290+
if (fh_match(&fp->fi_fhandle, fh)) {
32993291
if (atomic_inc_not_zero(&fp->fi_ref))
33003292
return fp;
33013293
}
@@ -4290,7 +4282,7 @@ laundromat_main(struct work_struct *laundry)
42904282

42914283
static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_ol_stateid *stp)
42924284
{
4293-
if (!nfsd_fh_match(&fhp->fh_handle, &stp->st_stid.sc_file->fi_fhandle))
4285+
if (!fh_match(&fhp->fh_handle, &stp->st_stid.sc_file->fi_fhandle))
42944286
return nfserr_bad_stateid;
42954287
return nfs_ok;
42964288
}

fs/nfsd/nfsfh.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ fh_init(struct svc_fh *fhp, int maxsize)
187187
return fhp;
188188
}
189189

190+
static inline bool fh_match(struct knfsd_fh *fh1, struct knfsd_fh *fh2)
191+
{
192+
if (fh1->fh_size != fh2->fh_size)
193+
return false;
194+
if (memcmp(fh1->fh_base.fh_pad, fh2->fh_base.fh_pad, fh1->fh_size) != 0)
195+
return false;
196+
return true;
197+
}
198+
190199
#ifdef CONFIG_NFSD_V3
191200
/*
192201
* The wcc data stored in current_fh should be cleared

0 commit comments

Comments
 (0)