mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
During pool export flush the ARC asynchronously
This also includes removing L2 vdevs asynchronously. This commit also guarantees that spa_load_guid is unique. The zpool reguid feature introduced the spa_load_guid, which is a transient value used for runtime identification purposes in the ARC. This value is not the same as the spa's persistent pool guid. However, the value is seeded from spa_generate_load_guid() which does not check for uniqueness against the spa_load_guid from other pools. Although extremely rare, you can end up with two different pools sharing the same spa_load_guid value! So we guarantee that the value is always unique and additionally not still in use by an async arc flush task. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Allan Jude <allan@klarasystems.com> Signed-off-by: Don Brady <don.brady@klarasystems.com> Closes #16215
This commit is contained in:
@@ -63,8 +63,15 @@ extern "C" {
|
||||
(hdr)->b_psize = ((x) >> SPA_MINBLOCKSHIFT); \
|
||||
} while (0)
|
||||
|
||||
/* The l2size in the header is only used by L2 cache */
|
||||
#define HDR_SET_L2SIZE(hdr, x) do { \
|
||||
ASSERT(IS_P2ALIGNED((x), 1U << SPA_MINBLOCKSHIFT)); \
|
||||
(hdr)->b_l2size = ((x) >> SPA_MINBLOCKSHIFT); \
|
||||
} while (0)
|
||||
|
||||
#define HDR_GET_LSIZE(hdr) ((hdr)->b_lsize << SPA_MINBLOCKSHIFT)
|
||||
#define HDR_GET_PSIZE(hdr) ((hdr)->b_psize << SPA_MINBLOCKSHIFT)
|
||||
#define HDR_GET_L2SIZE(hdr) ((hdr)->b_l2size << SPA_MINBLOCKSHIFT)
|
||||
|
||||
typedef struct arc_buf_hdr arc_buf_hdr_t;
|
||||
typedef struct arc_buf arc_buf_t;
|
||||
@@ -322,8 +329,10 @@ void arc_freed(spa_t *spa, const blkptr_t *bp);
|
||||
int arc_cached(spa_t *spa, const blkptr_t *bp);
|
||||
|
||||
void arc_flush(spa_t *spa, boolean_t retry);
|
||||
void arc_flush_async(spa_t *spa);
|
||||
void arc_tempreserve_clear(uint64_t reserve);
|
||||
int arc_tempreserve_space(spa_t *spa, uint64_t reserve, uint64_t txg);
|
||||
boolean_t arc_async_flush_guid_inuse(uint64_t load_guid);
|
||||
|
||||
uint64_t arc_all_memory(void);
|
||||
uint64_t arc_default_max(uint64_t min, uint64_t allmem);
|
||||
|
||||
@@ -378,8 +378,8 @@ typedef struct l2arc_lb_ptr_buf {
|
||||
* L2ARC Internals
|
||||
*/
|
||||
typedef struct l2arc_dev {
|
||||
vdev_t *l2ad_vdev; /* vdev */
|
||||
spa_t *l2ad_spa; /* spa */
|
||||
vdev_t *l2ad_vdev; /* can be NULL during remove */
|
||||
spa_t *l2ad_spa; /* can be NULL during remove */
|
||||
uint64_t l2ad_hand; /* next write location */
|
||||
uint64_t l2ad_start; /* first addr on device */
|
||||
uint64_t l2ad_end; /* last addr on device */
|
||||
@@ -475,8 +475,8 @@ struct arc_buf_hdr {
|
||||
|
||||
arc_buf_contents_t b_type;
|
||||
uint8_t b_complevel;
|
||||
uint8_t b_reserved1; /* used for 4 byte alignment */
|
||||
uint16_t b_reserved2; /* used for 4 byte alignment */
|
||||
uint8_t b_reserved1; /* used for 4 byte alignment */
|
||||
uint16_t b_l2size; /* alignment or L2-only size */
|
||||
arc_buf_hdr_t *b_hash_next;
|
||||
arc_flags_t b_flags;
|
||||
|
||||
|
||||
@@ -1106,6 +1106,7 @@ extern boolean_t spa_guid_exists(uint64_t pool_guid, uint64_t device_guid);
|
||||
extern char *spa_strdup(const char *);
|
||||
extern void spa_strfree(char *);
|
||||
extern uint64_t spa_generate_guid(spa_t *spa);
|
||||
extern uint64_t spa_generate_load_guid(void);
|
||||
extern void snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp);
|
||||
extern void spa_freeze(spa_t *spa);
|
||||
extern int spa_change_guid(spa_t *spa, const uint64_t *guidp);
|
||||
|
||||
Reference in New Issue
Block a user