diff options
author | Gluster Ant <bugzilla-bot@gluster.org> | 2018-09-12 17:22:48 +0530 |
---|---|---|
committer | Nigel Babu <nigelb@redhat.com> | 2018-09-12 17:22:48 +0530 |
commit | 45a71c0548b6fd2c757aa2e7b7671a1411948894 (patch) | |
tree | 2a5a9b73bae47ab53a41166fd041a06612587f48 /xlators/nfs/server/src/nfs3.h | |
parent | be77dbbda692792335a8e9e7c02e0c281f003c40 (diff) |
Land clang-format changes
Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
Diffstat (limited to 'xlators/nfs/server/src/nfs3.h')
-rw-r--r-- | xlators/nfs/server/src/nfs3.h | 376 |
1 files changed, 191 insertions, 185 deletions
diff --git a/xlators/nfs/server/src/nfs3.h b/xlators/nfs/server/src/nfs3.h index 187fb7e1912..f6d98d9f308 100644 --- a/xlators/nfs/server/src/nfs3.h +++ b/xlators/nfs/server/src/nfs3.h @@ -26,13 +26,12 @@ #include "refcount.h" #include <sys/statvfs.h> -#define GF_NFS3 GF_NFS"-nfsv3" - -#define GF_NFS3_DEFAULT_MEMFACTOR 15 -#define GF_NFS3_IOBPOOL_MULT GF_NFS_CONCURRENT_OPS_MULT -#define GF_NFS3_CLTABLE_BUCKETS_MULT 2 -#define GF_NFS3_FDTABLE_BUCKETS_MULT 2 +#define GF_NFS3 GF_NFS "-nfsv3" +#define GF_NFS3_DEFAULT_MEMFACTOR 15 +#define GF_NFS3_IOBPOOL_MULT GF_NFS_CONCURRENT_OPS_MULT +#define GF_NFS3_CLTABLE_BUCKETS_MULT 2 +#define GF_NFS3_FDTABLE_BUCKETS_MULT 2 /* Static values used for FSINFO * To change the maximum rsize and wsize supported by the NFS client, adjust @@ -43,136 +42,143 @@ * * NB: For Kernel-NFS, NFS_MAX_FILE_IO_SIZE is 1048576U (1MB). */ -#define GF_NFS3_FILE_IO_SIZE_MAX (1 * GF_UNIT_MB) /* 1048576 */ -#define GF_NFS3_FILE_IO_SIZE_MIN (4 * GF_UNIT_KB) /* 4096 */ +#define GF_NFS3_FILE_IO_SIZE_MAX (1 * GF_UNIT_MB) /* 1048576 */ +#define GF_NFS3_FILE_IO_SIZE_MIN (4 * GF_UNIT_KB) /* 4096 */ -#define GF_NFS3_FILE_IO_SIZE_DEF GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_FILE_IO_SIZE_DEF GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_RTMAX GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_RTMIN GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_RTPREF GF_NFS3_FILE_IO_SIZE_DEF -#define GF_NFS3_RTMULT GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_RTMAX GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_RTMIN GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_RTPREF GF_NFS3_FILE_IO_SIZE_DEF +#define GF_NFS3_RTMULT GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_WTMAX GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_WTMIN GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_WTPREF GF_NFS3_FILE_IO_SIZE_DEF -#define GF_NFS3_WTMULT GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_WTMAX GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_WTMIN GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_WTPREF GF_NFS3_FILE_IO_SIZE_DEF +#define GF_NFS3_WTMULT GF_NFS3_FILE_IO_SIZE_MIN /* This can be tuned through nfs.readdir-size */ -#define GF_NFS3_DTMAX GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_DTMIN GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_DTPREF GF_NFS3_FILE_IO_SIZE_DEF +#define GF_NFS3_DTMAX GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_DTMIN GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_DTPREF GF_NFS3_FILE_IO_SIZE_DEF -#define GF_NFS3_MAXFILESIZE (1 * GF_UNIT_PB) +#define GF_NFS3_MAXFILESIZE (1 * GF_UNIT_PB) -#define GF_NFS3_IO_SIZE 4096 /* 4-KB */ -#define GF_NFS3_IO_SHIFT 12 /* 2^12 = 4KB */ +#define GF_NFS3_IO_SIZE 4096 /* 4-KB */ +#define GF_NFS3_IO_SHIFT 12 /* 2^12 = 4KB */ /* FIXME: Handle time resolutions */ -#define GF_NFS3_TIMEDELTA_SECS {1,0} -#define GF_NFS3_TIMEDELTA_NSECS {0,1} -#define GF_NFS3_TIMEDELTA_MSECS {0,1000000} - -#define GF_NFS3_FS_PROP (FSF3_LINK | FSF3_SYMLINK | FSF3_HOMOGENEOUS | FSF3_CANSETTIME) - -#define GF_NFS3_DIRFD_VALID 1 -#define GF_NFS3_DIRFD_INVALID 0 - -#define GF_NFS3_VOLACCESS_RW 1 -#define GF_NFS3_VOLACCESS_RO 2 - - -#define GF_NFS3_FDCACHE_SIZE 512 +#define GF_NFS3_TIMEDELTA_SECS \ + { \ + 1, 0 \ + } +#define GF_NFS3_TIMEDELTA_NSECS \ + { \ + 0, 1 \ + } +#define GF_NFS3_TIMEDELTA_MSECS \ + { \ + 0, 1000000 \ + } + +#define GF_NFS3_FS_PROP \ + (FSF3_LINK | FSF3_SYMLINK | FSF3_HOMOGENEOUS | FSF3_CANSETTIME) + +#define GF_NFS3_DIRFD_VALID 1 +#define GF_NFS3_DIRFD_INVALID 0 + +#define GF_NFS3_VOLACCESS_RW 1 +#define GF_NFS3_VOLACCESS_RO 2 + +#define GF_NFS3_FDCACHE_SIZE 512 /* This should probably be moved to a more generic layer so that if needed * different versions of NFS protocol can use the same thing. */ struct nfs3_fd_entry { - fd_t *cachedfd; - struct list_head list; + fd_t *cachedfd; + struct list_head list; }; /* Per subvolume nfs3 specific state */ struct nfs3_export { - struct list_head explist; - xlator_t *subvol; - uuid_t volumeid; - int access; - int trusted_sync; - int trusted_write; - int rootlookedup; + struct list_head explist; + xlator_t *subvol; + uuid_t volumeid; + int access; + int trusted_sync; + int trusted_write; + int rootlookedup; }; -#define GF_NFS3_DEFAULT_VOLACCESS (GF_NFS3_VOLACCESS_RW) +#define GF_NFS3_DEFAULT_VOLACCESS (GF_NFS3_VOLACCESS_RW) /* The NFSv3 protocol state */ typedef struct nfs3_state { - - /* The NFS xlator pointer. The NFS xlator can be running - * multiple versions of the NFS protocol. - */ - xlator_t *nfsx; - - /* The iob pool from which memory allocations are made for receiving - * and sending network messages. - */ - struct iobuf_pool *iobpool; - - /* List of child subvolumes for the NFSv3 protocol. - * Right now, is simply referring to the list of children in nfsx above. - */ - xlator_list_t *exportslist; - - struct list_head exports; - /* Mempool for allocations of struct nfs3_local */ - struct mem_pool *localpool; - - /* Server start-up timestamp, currently used for write verifier. */ - uint64_t serverstart; - - /* NFSv3 Protocol configurables */ - uint64_t readsize; - uint64_t writesize; - uint64_t readdirsize; - - /* Size of the iobufs used, depends on the sizes of the three params - * above. - */ - uint64_t iobsize; - - struct list_head fdlru; - gf_lock_t fdlrulock; - int fdcount; - uint32_t occ_logger; + /* The NFS xlator pointer. The NFS xlator can be running + * multiple versions of the NFS protocol. + */ + xlator_t *nfsx; + + /* The iob pool from which memory allocations are made for receiving + * and sending network messages. + */ + struct iobuf_pool *iobpool; + + /* List of child subvolumes for the NFSv3 protocol. + * Right now, is simply referring to the list of children in nfsx above. + */ + xlator_list_t *exportslist; + + struct list_head exports; + /* Mempool for allocations of struct nfs3_local */ + struct mem_pool *localpool; + + /* Server start-up timestamp, currently used for write verifier. */ + uint64_t serverstart; + + /* NFSv3 Protocol configurables */ + uint64_t readsize; + uint64_t writesize; + uint64_t readdirsize; + + /* Size of the iobufs used, depends on the sizes of the three params + * above. + */ + uint64_t iobsize; + + struct list_head fdlru; + gf_lock_t fdlrulock; + int fdcount; + uint32_t occ_logger; } nfs3_state_t; typedef enum nfs3_lookup_type { - GF_NFS3_REVALIDATE = 1, - GF_NFS3_FRESH, + GF_NFS3_REVALIDATE = 1, + GF_NFS3_FRESH, } nfs3_lookup_type_t; typedef union args_ { - nlm4_stat nlm4_stat; - nlm4_holder nlm4_holder; - nlm4_lock nlm4_lock; - nlm4_share nlm4_share; - nlm4_testrply nlm4_testrply; - nlm4_testres nlm4_testres; - nlm4_testargs nlm4_testargs; - nlm4_res nlm4_res; - nlm4_lockargs nlm4_lockargs; - nlm4_cancargs nlm4_cancargs; - nlm4_unlockargs nlm4_unlockargs; - nlm4_shareargs nlm4_shareargs; - nlm4_shareres nlm4_shareres; - nlm4_freeallargs nlm4_freeallargs; - getaclargs getaclargs; - setaclargs setaclargs; - getaclreply getaclreply; - setaclreply setaclreply; + nlm4_stat nlm4_stat; + nlm4_holder nlm4_holder; + nlm4_lock nlm4_lock; + nlm4_share nlm4_share; + nlm4_testrply nlm4_testrply; + nlm4_testres nlm4_testres; + nlm4_testargs nlm4_testargs; + nlm4_res nlm4_res; + nlm4_lockargs nlm4_lockargs; + nlm4_cancargs nlm4_cancargs; + nlm4_unlockargs nlm4_unlockargs; + nlm4_shareargs nlm4_shareargs; + nlm4_shareres nlm4_shareres; + nlm4_freeallargs nlm4_freeallargs; + getaclargs getaclargs; + setaclargs setaclargs; + getaclreply getaclreply; + setaclreply setaclreply; } args; - -typedef int (*nfs3_resume_fn_t) (void *cs); +typedef int (*nfs3_resume_fn_t)(void *cs); /* Structure used to communicate state between a fop and its callback. * Not all members are used at all times. Usage is fop and NFS request * dependent. @@ -185,80 +191,80 @@ typedef int (*nfs3_resume_fn_t) (void *cs); * Imagine the chaos if we need a mem-pool for each one of those sub-structures. */ struct nfs3_local { - GF_REF_DECL; - - rpcsvc_request_t *req; - xlator_t *vol; - nfs3_resume_fn_t resume_fn; - xlator_t *nfsx; - struct nfs3_state *nfs3state; - - /* The list hook to attach this call state to the inode's queue till - * the opening of the fd on the inode completes. - */ - struct list_head openwait_q; - - /* Per-NFSv3 Op state */ - struct nfs3_fh parent; - struct nfs3_fh fh; - fd_t *fd; - uint32_t accessbits; - int operrno; - count3 dircount; - count3 maxcount; - struct statvfs fsstat; - gf_dirent_t entries; - struct iatt stbuf; - struct iatt preparent; - struct iatt postparent; - int32_t setattr_valid; - nfstime3 timestamp; - loc_t oploc; - int writetype; - count3 datacount; - offset3 dataoffset; - struct iobuf *iob; - struct iobref *iobref; - createmode3 createmode; - uint64_t cookieverf; - int sattrguardcheck; - char *pathname; - ftype3 mknodtype; - specdata3 devnums; - cookie3 cookie; - struct iovec datavec; - mode_t mode; - struct iatt attr_in; - - /* NFSv3 FH resolver state */ - int hardresolved; - struct nfs3_fh resolvefh; - loc_t resolvedloc; - int resolve_ret; - int resolve_errno; - int hashidx; - fd_t *resolve_dir_fd; - char *resolventry; - nfs3_lookup_type_t lookuptype; - gf_dirent_t *hashmatch; - gf_dirent_t *entrymatch; - off_t lastentryoffset; - struct flock flock; - args args; - nlm4_lkowner_t lkowner; - char cookiebytes[1024]; - struct nfs3_fh lockfh; - int monitor; - rpc_transport_t *trans; - call_frame_t *frame; - - /* ACL */ - aclentry aclentry[NFS_ACL_MAX_ENTRIES]; - aclentry daclentry[NFS_ACL_MAX_ENTRIES]; - int aclcount; - char aclxattr[NFS_ACL_MAX_ENTRIES*8 + 4]; - int daclcount; - char daclxattr[NFS_ACL_MAX_ENTRIES*8 + 4]; + GF_REF_DECL; + + rpcsvc_request_t *req; + xlator_t *vol; + nfs3_resume_fn_t resume_fn; + xlator_t *nfsx; + struct nfs3_state *nfs3state; + + /* The list hook to attach this call state to the inode's queue till + * the opening of the fd on the inode completes. + */ + struct list_head openwait_q; + + /* Per-NFSv3 Op state */ + struct nfs3_fh parent; + struct nfs3_fh fh; + fd_t *fd; + uint32_t accessbits; + int operrno; + count3 dircount; + count3 maxcount; + struct statvfs fsstat; + gf_dirent_t entries; + struct iatt stbuf; + struct iatt preparent; + struct iatt postparent; + int32_t setattr_valid; + nfstime3 timestamp; + loc_t oploc; + int writetype; + count3 datacount; + offset3 dataoffset; + struct iobuf *iob; + struct iobref *iobref; + createmode3 createmode; + uint64_t cookieverf; + int sattrguardcheck; + char *pathname; + ftype3 mknodtype; + specdata3 devnums; + cookie3 cookie; + struct iovec datavec; + mode_t mode; + struct iatt attr_in; + + /* NFSv3 FH resolver state */ + int hardresolved; + struct nfs3_fh resolvefh; + loc_t resolvedloc; + int resolve_ret; + int resolve_errno; + int hashidx; + fd_t *resolve_dir_fd; + char *resolventry; + nfs3_lookup_type_t lookuptype; + gf_dirent_t *hashmatch; + gf_dirent_t *entrymatch; + off_t lastentryoffset; + struct flock flock; + args args; + nlm4_lkowner_t lkowner; + char cookiebytes[1024]; + struct nfs3_fh lockfh; + int monitor; + rpc_transport_t *trans; + call_frame_t *frame; + + /* ACL */ + aclentry aclentry[NFS_ACL_MAX_ENTRIES]; + aclentry daclentry[NFS_ACL_MAX_ENTRIES]; + int aclcount; + char aclxattr[NFS_ACL_MAX_ENTRIES * 8 + 4]; + int daclcount; + char daclxattr[NFS_ACL_MAX_ENTRIES * 8 + 4]; }; #define nfs3_is_revalidate_lookup(cst) ((cst)->lookuptype == GF_NFS3_REVALIDATE) @@ -270,17 +276,17 @@ typedef struct nfs3_local nfs3_call_state_t; /* Queue of ops waiting for open fop to return. */ struct inode_op_queue { - struct list_head opq; - pthread_mutex_t qlock; + struct list_head opq; + pthread_mutex_t qlock; }; extern rpcsvc_program_t * -nfs3svc_init (xlator_t *nfsx); +nfs3svc_init(xlator_t *nfsx); extern int -nfs3_reconfigure_state (xlator_t *nfsx, dict_t *options); +nfs3_reconfigure_state(xlator_t *nfsx, dict_t *options); extern uint64_t -nfs3_request_xlator_deviceid (rpcsvc_request_t *req); +nfs3_request_xlator_deviceid(rpcsvc_request_t *req); #endif |