nfs_fs_sb.h 4.1 KB

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