Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd: convert nfs4_file->fi_fds array to use nfsd_files

Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Jeff Layton and committed by
J. Bruce Fields
fd4f83fd 5920afa3

+19 -18
+18 -17
fs/nfsd/nfs4state.c
··· 50 50 51 51 #include "netns.h" 52 52 #include "pnfs.h" 53 + #include "filecache.h" 53 54 54 55 #define NFSDDBG_FACILITY NFSDDBG_PROC 55 56 ··· 434 433 __nfs4_get_fd(struct nfs4_file *f, int oflag) 435 434 { 436 435 if (f->fi_fds[oflag]) 437 - return get_file(f->fi_fds[oflag]); 436 + return get_file(f->fi_fds[oflag]->nf_file); 438 437 return NULL; 439 438 } 440 439 ··· 591 590 might_lock(&fp->fi_lock); 592 591 593 592 if (atomic_dec_and_lock(&fp->fi_access[oflag], &fp->fi_lock)) { 594 - struct file *f1 = NULL; 595 - struct file *f2 = NULL; 593 + struct nfsd_file *f1 = NULL; 594 + struct nfsd_file *f2 = NULL; 596 595 597 596 swap(f1, fp->fi_fds[oflag]); 598 597 if (atomic_read(&fp->fi_access[1 - oflag]) == 0) 599 598 swap(f2, fp->fi_fds[O_RDWR]); 600 599 spin_unlock(&fp->fi_lock); 601 600 if (f1) 602 - fput(f1); 601 + nfsd_file_put(f1); 603 602 if (f2) 604 - fput(f2); 603 + nfsd_file_put(f2); 605 604 } 606 605 } 607 606 ··· 2324 2323 spin_unlock(&clp->cl_lock); 2325 2324 } 2326 2325 2327 - static void nfs4_show_superblock(struct seq_file *s, struct file *f) 2326 + static void nfs4_show_superblock(struct seq_file *s, struct nfsd_file *f) 2328 2327 { 2329 - struct inode *inode = file_inode(f); 2328 + struct inode *inode = f->nf_inode; 2330 2329 2331 2330 seq_printf(s, "superblock: \"%02x:%02x:%ld\"", 2332 2331 MAJOR(inode->i_sb->s_dev), ··· 2344 2343 { 2345 2344 struct nfs4_ol_stateid *ols; 2346 2345 struct nfs4_file *nf; 2347 - struct file *file; 2346 + struct nfsd_file *file; 2348 2347 struct nfs4_stateowner *oo; 2349 2348 unsigned int access, deny; 2350 2349 ··· 2371 2370 seq_printf(s, ", "); 2372 2371 nfs4_show_owner(s, oo); 2373 2372 seq_printf(s, " }\n"); 2374 - fput(file); 2373 + nfsd_file_put(file); 2375 2374 2376 2375 return 0; 2377 2376 } ··· 2380 2379 { 2381 2380 struct nfs4_ol_stateid *ols; 2382 2381 struct nfs4_file *nf; 2383 - struct file *file; 2382 + struct nfsd_file *file; 2384 2383 struct nfs4_stateowner *oo; 2385 2384 2386 2385 ols = openlockstateid(st); ··· 2402 2401 seq_printf(s, ", "); 2403 2402 nfs4_show_owner(s, oo); 2404 2403 seq_printf(s, " }\n"); 2405 - fput(file); 2404 + nfsd_file_put(file); 2406 2405 2407 2406 return 0; 2408 2407 } ··· 4652 4651 struct svc_fh *cur_fh, struct nfs4_ol_stateid *stp, 4653 4652 struct nfsd4_open *open) 4654 4653 { 4655 - struct file *filp = NULL; 4654 + struct nfsd_file *nf = NULL; 4656 4655 __be32 status; 4657 4656 int oflag = nfs4_access_to_omode(open->op_share_access); 4658 4657 int access = nfs4_access_to_access(open->op_share_access); ··· 4688 4687 4689 4688 if (!fp->fi_fds[oflag]) { 4690 4689 spin_unlock(&fp->fi_lock); 4691 - status = nfsd_open(rqstp, cur_fh, S_IFREG, access, &filp); 4690 + status = nfsd_file_acquire(rqstp, cur_fh, access, &nf); 4692 4691 if (status) 4693 4692 goto out_put_access; 4694 4693 spin_lock(&fp->fi_lock); 4695 4694 if (!fp->fi_fds[oflag]) { 4696 - fp->fi_fds[oflag] = filp; 4697 - filp = NULL; 4695 + fp->fi_fds[oflag] = nf; 4696 + nf = NULL; 4698 4697 } 4699 4698 } 4700 4699 spin_unlock(&fp->fi_lock); 4701 - if (filp) 4702 - fput(filp); 4700 + if (nf) 4701 + nfsd_file_put(nf); 4703 4702 4704 4703 status = nfsd4_truncate(rqstp, cur_fh, open); 4705 4704 if (status)
+1 -1
fs/nfsd/state.h
··· 506 506 }; 507 507 struct list_head fi_clnt_odstate; 508 508 /* One each for O_RDONLY, O_WRONLY, O_RDWR: */ 509 - struct file * fi_fds[3]; 509 + struct nfsd_file *fi_fds[3]; 510 510 /* 511 511 * Each open or lock stateid contributes 0-4 to the counts 512 512 * below depending on which bits are set in st_access_bitmap: