Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/raid/g_raid.h
Show All 31 Lines | |||||
#define _G_RAID_H_ | #define _G_RAID_H_ | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/kobj.h> | #include <sys/kobj.h> | ||||
#include <sys/bio.h> | #include <sys/bio.h> | ||||
#include <sys/time.h> | #include <sys/time.h> | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <geom/geom_int.h> | |||||
#endif | #endif | ||||
#define G_RAID_CLASS_NAME "RAID" | #define G_RAID_CLASS_NAME "RAID" | ||||
#define G_RAID_MAGIC "GEOM::RAID" | #define G_RAID_MAGIC "GEOM::RAID" | ||||
#define G_RAID_VERSION 0 | #define G_RAID_VERSION 0 | ||||
struct g_raid_md_object; | struct g_raid_md_object; | ||||
struct g_raid_tr_object; | struct g_raid_tr_object; | ||||
#define G_RAID_DEVICE_FLAG_NOAUTOSYNC 0x0000000000000001ULL | #define G_RAID_DEVICE_FLAG_NOAUTOSYNC 0x0000000000000001ULL | ||||
#define G_RAID_DEVICE_FLAG_NOFAILSYNC 0x0000000000000002ULL | #define G_RAID_DEVICE_FLAG_NOFAILSYNC 0x0000000000000002ULL | ||||
#define G_RAID_DEVICE_FLAG_MASK (G_RAID_DEVICE_FLAG_NOAUTOSYNC | \ | #define G_RAID_DEVICE_FLAG_MASK (G_RAID_DEVICE_FLAG_NOAUTOSYNC | \ | ||||
G_RAID_DEVICE_FLAG_NOFAILSYNC) | G_RAID_DEVICE_FLAG_NOFAILSYNC) | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
extern u_int g_raid_aggressive_spare; | extern u_int g_raid_aggressive_spare; | ||||
extern u_int g_raid_debug; | extern u_int g_raid_debug; | ||||
extern int g_raid_enable; | extern int g_raid_enable; | ||||
extern int g_raid_read_err_thresh; | extern int g_raid_read_err_thresh; | ||||
extern u_int g_raid_start_timeout; | extern u_int g_raid_start_timeout; | ||||
extern struct g_class g_raid_class; | extern struct g_class g_raid_class; | ||||
#define G_RAID_DEBUG(lvl, fmt, ...) do { \ | #define G_RAID_DEBUG(lvl, ...) \ | ||||
if (g_raid_debug >= (lvl)) { \ | _GEOM_DEBUG("GEOM_RAID", g_raid_debug, (lvl), NULL, __VA_ARGS__) | ||||
if (g_raid_debug > 0) { \ | #define G_RAID_DEBUG1(lvl, sc, fmt, ...) \ | ||||
printf("GEOM_RAID[%u]: " fmt "\n", \ | _GEOM_DEBUG("GEOM_RAID", g_raid_debug, (lvl), NULL, "%s: " fmt, \ | ||||
lvl, ## __VA_ARGS__); \ | (sc)->sc_name, ## __VA_ARGS__) | ||||
} else { \ | #define G_RAID_LOGREQ(lvl, bp, ...) \ | ||||
printf("GEOM_RAID: " fmt "\n", \ | _GEOM_DEBUG("GEOM_RAID", g_raid_debug, (lvl), (bp), __VA_ARGS__) | ||||
## __VA_ARGS__); \ | |||||
} \ | |||||
} \ | |||||
} while (0) | |||||
#define G_RAID_DEBUG1(lvl, sc, fmt, ...) do { \ | |||||
if (g_raid_debug >= (lvl)) { \ | |||||
if (g_raid_debug > 0) { \ | |||||
printf("GEOM_RAID[%u]: %s: " fmt "\n", \ | |||||
lvl, (sc)->sc_name, ## __VA_ARGS__); \ | |||||
} else { \ | |||||
printf("GEOM_RAID: %s: " fmt "\n", \ | |||||
(sc)->sc_name, ## __VA_ARGS__); \ | |||||
} \ | |||||
} \ | |||||
} while (0) | |||||
#define G_RAID_LOGREQ(lvl, bp, fmt, ...) do { \ | |||||
if (g_raid_debug >= (lvl)) { \ | |||||
if (g_raid_debug > 0) { \ | |||||
printf("GEOM_RAID[%u]: " fmt " ", \ | |||||
lvl, ## __VA_ARGS__); \ | |||||
} else \ | |||||
printf("GEOM_RAID: " fmt " ", ## __VA_ARGS__); \ | |||||
g_print_bio(bp); \ | |||||
printf("\n"); \ | |||||
} \ | |||||
} while (0) | |||||
/* | /* | ||||
* Flags we use to distinguish I/O initiated by the TR layer to maintain | * Flags we use to distinguish I/O initiated by the TR layer to maintain | ||||
* the volume's characteristics, fix subdisks, extra copies of data, etc. | * the volume's characteristics, fix subdisks, extra copies of data, etc. | ||||
* | * | ||||
* G_RAID_BIO_FLAG_SYNC I/O to update an extra copy of the data | * G_RAID_BIO_FLAG_SYNC I/O to update an extra copy of the data | ||||
* for RAID volumes that maintain extra data | * for RAID volumes that maintain extra data | ||||
* and need to rebuild that data. | * and need to rebuild that data. | ||||
▲ Show 20 Lines • Show All 367 Lines • Show Last 20 Lines |