xref: /spdk/lib/ftl/ftl_sb_current.h (revision bf30e09abe1667ae2769aa367cde39c550bcac00)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (C) 2022 Intel Corporation.
3  *   All rights reserved.
4  */
5 
6 #ifndef FTL_SB_CURRENT_H
7 #define FTL_SB_CURRENT_H
8 
9 #include "spdk/uuid.h"
10 #include "ftl_sb_common.h"
11 
12 #define FTL_SB_VERSION_5			5
13 #define FTL_SB_VERSION_CURRENT			FTL_SB_VERSION_5
14 
15 struct ftl_superblock {
16 	struct ftl_superblock_header	header;
17 
18 	struct spdk_uuid		uuid;
19 
20 	/* Current sequence number */
21 	uint64_t			seq_id;
22 
23 	/* Flag describing clean shutdown */
24 	uint64_t			clean;
25 
26 	/* Number of surfaced LBAs */
27 	uint64_t			lba_cnt;
28 
29 	/* Percentage of base device blocks not exposed to the user */
30 	uint64_t			overprovisioning;
31 
32 	/* Maximum IO depth per band relocate */
33 	uint64_t			max_reloc_qdepth;
34 
35 	/* Flag indicates that the FTL is ready for upgrade */
36 	uint8_t				upgrade_ready;
37 
38 	/* Reserved field */
39 	uint8_t				reserved3[15];
40 
41 	/* Last L2P checkpoint +1 (i.e. min_seq_id, 0:no ckpt) */
42 	uint64_t			ckpt_seq_id;
43 
44 	struct ftl_superblock_gc_info	gc_info;
45 
46 	/* Points to the end of blob area */
47 	ftl_df_obj_id			blob_area_end;
48 
49 	/* NVC device name */
50 	char				nvc_dev_name[16];
51 
52 	/* NVC-stored MD layout tracking info */
53 	struct ftl_superblock_v5_md_blob_hdr	md_layout_nvc;
54 
55 	/* Base device name */
56 	char					base_dev_name[16];
57 
58 	/* Base dev-stored MD layout tracking info */
59 	struct ftl_superblock_v5_md_blob_hdr	md_layout_base;
60 
61 	/* FTL layout params */
62 	struct ftl_superblock_v5_md_blob_hdr	layout_params;
63 
64 	/* Start of the blob area */
65 	char blob_area[0];
66 } __attribute__((packed));
67 
68 SPDK_STATIC_ASSERT(offsetof(struct ftl_superblock, header) == 0,
69 		   "Invalid placement of header");
70 
71 SPDK_STATIC_ASSERT(FTL_SUPERBLOCK_SIZE >= sizeof(struct ftl_superblock),
72 		   "FTL SB metadata size is invalid");
73 
74 #endif /* FTL_SB_CURRENT_H */
75