Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  *  NFSv4 file layout driver data structures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *  Copyright (c) 2002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  The Regents of the University of Michigan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *  All Rights Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *  Dean Hildebrand <dhildebz@umich.edu>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *  Permission is granted to use, copy, create derivative works, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *  redistribute this software and such derivative works for any purpose,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *  so long as the name of the University of Michigan is not used in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *  any advertising or publicity pertaining to the use or distribution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *  of this software without specific, written prior authorization. If
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *  the above copyright notice or any other identification of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *  University of Michigan is included in any copy of any portion of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *  this software, then the disclaimer below must also be included.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *  This software is provided as is, without representation or warranty
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *  of any kind either express or implied, including without limitation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *  the implied warranties of merchantability, fitness for a particular
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *  purpose, or noninfringement.  The Regents of the University of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *  Michigan shall not be liable for any damages, including special,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *  indirect, incidental, or consequential damages, with respect to any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *  claim arising out of or in connection with the use of the software,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *  even if it has been or is hereafter advised of the possibility of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *  such damages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #ifndef FS_NFS_NFS4FILELAYOUT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define FS_NFS_NFS4FILELAYOUT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include "../pnfs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * Field testing shows we need to support up to 4096 stripe indices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  * We store each index as a u8 (u32 on the wire) to keep the memory footprint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  * reasonable. This in turn means we support a maximum of 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * RFC 5661 multipath_list4 structures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define NFS4_PNFS_MAX_STRIPE_CNT 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define NFS4_PNFS_MAX_MULTI_CNT  256 /* 256 fit into a u8 stripe_index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) enum stripetype4 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	STRIPE_SPARSE = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	STRIPE_DENSE = 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) struct nfs4_file_layout_dsaddr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	struct nfs4_deviceid_node	id_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	u32				stripe_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	u8				*stripe_indices;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	u32				ds_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	struct nfs4_pnfs_ds		*ds_list[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) struct nfs4_filelayout_segment {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	struct pnfs_layout_segment	generic_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	u32				stripe_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	u32				commit_through_mds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	u32				stripe_unit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	u32				first_stripe_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	u64				pattern_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	struct nfs4_deviceid		deviceid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	struct nfs4_file_layout_dsaddr	*dsaddr; /* Point to GETDEVINFO data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	unsigned int			num_fh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	struct nfs_fh			**fh_array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) struct nfs4_filelayout {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	struct pnfs_layout_hdr generic_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	struct pnfs_ds_commit_info commit_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) static inline struct nfs4_filelayout *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) FILELAYOUT_FROM_HDR(struct pnfs_layout_hdr *lo)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	return container_of(lo, struct nfs4_filelayout, generic_hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) static inline struct nfs4_filelayout_segment *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) FILELAYOUT_LSEG(struct pnfs_layout_segment *lseg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	return container_of(lseg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 			    struct nfs4_filelayout_segment,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 			    generic_hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) static inline struct nfs4_deviceid_node *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) FILELAYOUT_DEVID_NODE(struct pnfs_layout_segment *lseg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	return &FILELAYOUT_LSEG(lseg)->dsaddr->id_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) static inline bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) filelayout_test_devid_invalid(struct nfs4_deviceid_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	return test_bit(NFS_DEVICEID_INVALID, &node->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) extern bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) filelayout_test_devid_unavailable(struct nfs4_deviceid_node *node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) extern struct nfs_fh *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) u32 nfs4_fl_calc_j_index(struct pnfs_layout_segment *lseg, loff_t offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) u32 nfs4_fl_calc_ds_index(struct pnfs_layout_segment *lseg, u32 j);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct nfs4_pnfs_ds *nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 					u32 ds_idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) extern struct nfs4_file_layout_dsaddr *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) nfs4_fl_alloc_deviceid_node(struct nfs_server *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	struct pnfs_device *pdev, gfp_t gfp_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) extern void nfs4_fl_put_deviceid(struct nfs4_file_layout_dsaddr *dsaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) extern void nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #endif /* FS_NFS_NFS4FILELAYOUT_H */