hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/nfs/file.c
....@@ -487,8 +487,9 @@
487487 {
488488 unsigned long blocks;
489489 long long isize;
490
- struct rpc_clnt *clnt = NFS_CLIENT(file->f_mapping->host);
491
- struct inode *inode = file->f_mapping->host;
490
+ struct inode *inode = file_inode(file);
491
+ struct rpc_clnt *clnt = NFS_CLIENT(inode);
492
+ struct nfs_client *cl = NFS_SERVER(inode)->nfs_client;
492493
493494 spin_lock(&inode->i_lock);
494495 blocks = inode->i_blocks;
....@@ -501,14 +502,22 @@
501502
502503 *span = sis->pages;
503504
505
+
506
+ if (cl->rpc_ops->enable_swap)
507
+ cl->rpc_ops->enable_swap(inode);
508
+
504509 return rpc_clnt_swap_activate(clnt);
505510 }
506511
507512 static void nfs_swap_deactivate(struct file *file)
508513 {
509
- struct rpc_clnt *clnt = NFS_CLIENT(file->f_mapping->host);
514
+ struct inode *inode = file_inode(file);
515
+ struct rpc_clnt *clnt = NFS_CLIENT(inode);
516
+ struct nfs_client *cl = NFS_SERVER(inode)->nfs_client;
510517
511518 rpc_clnt_swap_deactivate(clnt);
519
+ if (cl->rpc_ops->disable_swap)
520
+ cl->rpc_ops->disable_swap(file_inode(file));
512521 }
513522
514523 const struct address_space_operations nfs_file_aops = {