nfs_fs_sb.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef _NFS_FS_SB
  2. #define _NFS_FS_SB
  3. #include <linux/list.h>
  4. #include <linux/backing-dev.h>
  5. #include <linux/wait.h>
  6. #include <asm/atomic.h>
  7. struct nfs_iostats;
  8. /*
  9. * The nfs_client identifies our client state to the server.
  10. */
  11. struct nfs_client {
  12. atomic_t cl_count;
  13. int cl_cons_state; /* current construction state (-ve: init error) */
  14. #define NFS_CS_READY 0 /* ready to be used */
  15. #define NFS_CS_INITING 1 /* busy initialising */
  16. unsigned long cl_res_state; /* NFS resources state */
  17. #define NFS_CS_CALLBACK 1 /* - callback started */
  18. #define NFS_CS_IDMAP 2 /* - idmap started */
  19. #define NFS_CS_RENEWD 3 /* - renewd started */
  20. struct sockaddr_in cl_addr; /* server identifier */
  21. char * cl_hostname; /* hostname of server */
  22. struct list_head cl_share_link; /* link in global client list */
  23. struct list_head cl_superblocks; /* List of nfs_server structs */
  24. struct rpc_clnt * cl_rpcclient;
  25. const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
  26. unsigned long retrans_timeo; /* retransmit timeout */
  27. unsigned int retrans_count; /* number of retransmit tries */
  28. #ifdef CONFIG_NFS_V4
  29. u64 cl_clientid; /* constant */
  30. nfs4_verifier cl_confirm;
  31. unsigned long cl_state;
  32. struct rb_root cl_openowner_id;
  33. struct rb_root cl_lockowner_id;
  34. /*
  35. * The following rwsem ensures exclusive access to the server
  36. * while we recover the state following a lease expiration.
  37. */
  38. struct rw_semaphore cl_sem;
  39. struct list_head cl_delegations;
  40. struct rb_root cl_state_owners;
  41. spinlock_t cl_lock;
  42. unsigned long cl_lease_time;
  43. unsigned long cl_last_renewal;
  44. struct delayed_work cl_renewd;
  45. struct rpc_wait_queue cl_rpcwaitq;
  46. /* used for the setclientid verifier */
  47. struct timespec cl_boot_time;
  48. /* idmapper */
  49. struct idmap * cl_idmap;
  50. /* Our own IP address, as a null-terminated string.
  51. * This is used to generate the clientid, and the callback address.
  52. */
  53. char cl_ipaddr[48];
  54. unsigned char cl_id_uniquifier;
  55. #endif
  56. };
  57. /*
  58. * NFS client parameters stored in the superblock.
  59. */
  60. struct nfs_server {
  61. struct nfs_client * nfs_client; /* shared client and NFS4 state */
  62. struct list_head client_link; /* List of other nfs_server structs
  63. * that share the same client
  64. */
  65. struct list_head master_link; /* link in master servers list */
  66. struct rpc_clnt * client; /* RPC client handle */
  67. struct rpc_clnt * client_acl; /* ACL RPC client handle */
  68. struct nfs_iostats * io_stats; /* I/O statistics */
  69. struct backing_dev_info backing_dev_info;
  70. atomic_long_t writeback; /* number of writeback pages */
  71. int flags; /* various flags */
  72. unsigned int caps; /* server capabilities */
  73. unsigned int rsize; /* read size */
  74. unsigned int rpages; /* read size (in pages) */
  75. unsigned int wsize; /* write size */
  76. unsigned int wpages; /* write size (in pages) */
  77. unsigned int wtmult; /* server disk block size */
  78. unsigned int dtsize; /* readdir size */
  79. unsigned int bsize; /* server block size */
  80. unsigned int acregmin; /* attr cache timeouts */
  81. unsigned int acregmax;
  82. unsigned int acdirmin;
  83. unsigned int acdirmax;
  84. unsigned int namelen;
  85. struct nfs_fsid fsid;
  86. __u64 maxfilesize; /* maximum file size */
  87. unsigned long mount_time; /* when this fs was mounted */
  88. dev_t s_dev; /* superblock dev numbers */
  89. #ifdef CONFIG_NFS_V4
  90. u32 attr_bitmask[2];/* V4 bitmask representing the set
  91. of attributes supported on this
  92. filesystem */
  93. u32 acl_bitmask; /* V4 bitmask representing the ACEs
  94. that are supported on this
  95. filesystem */
  96. #endif
  97. void (*destroy)(struct nfs_server *);
  98. atomic_t active; /* Keep trace of any activity to this server */
  99. wait_queue_head_t active_wq; /* Wait for any activity to stop */
  100. };
  101. /* Server capabilities */
  102. #define NFS_CAP_READDIRPLUS (1U << 0)
  103. #define NFS_CAP_HARDLINKS (1U << 1)
  104. #define NFS_CAP_SYMLINKS (1U << 2)
  105. #define NFS_CAP_ACLS (1U << 3)
  106. #define NFS_CAP_ATOMIC_OPEN (1U << 4)
  107. #endif