mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
update for bcache header changes
Change-Id: I5c64d438dac8bc28411f9a25e1be711477a3af80
This commit is contained in:
parent
b765c10d0c
commit
2f0a24917b
9
bcache.c
9
bcache.c
@ -434,7 +434,7 @@ unsigned hatoi_validate(const char *s, const char *msg)
|
|||||||
static void do_write_sb(int fd, struct cache_sb *sb)
|
static void do_write_sb(int fd, struct cache_sb *sb)
|
||||||
{
|
{
|
||||||
char zeroes[SB_START] = {0};
|
char zeroes[SB_START] = {0};
|
||||||
size_t bytes = ((void *) bset_bkey_last(sb)) - (void *) sb;
|
size_t bytes = ((void *) __bset_bkey_last(sb)) - (void *) sb;
|
||||||
|
|
||||||
/* Zero start of disk */
|
/* Zero start of disk */
|
||||||
if (pwrite(fd, zeroes, SB_START, 0) != SB_START) {
|
if (pwrite(fd, zeroes, SB_START, 0) != SB_START) {
|
||||||
@ -807,11 +807,6 @@ void show_super_backingdev(struct cache_sb *sb, bool force_csum)
|
|||||||
if (sb->version == BCACHE_SB_VERSION_BDEV) {
|
if (sb->version == BCACHE_SB_VERSION_BDEV) {
|
||||||
first_sector = BDEV_DATA_START_DEFAULT;
|
first_sector = BDEV_DATA_START_DEFAULT;
|
||||||
} else {
|
} else {
|
||||||
if (sb->keys == 1 || sb->d[0]) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"Possible experimental format detected, bailing\n");
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
first_sector = sb->data_offset;
|
first_sector = sb->data_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,7 +820,7 @@ void show_super_backingdev(struct cache_sb *sb, bool force_csum)
|
|||||||
|
|
||||||
static void show_cache_member(struct cache_sb *sb, unsigned i)
|
static void show_cache_member(struct cache_sb *sb, unsigned i)
|
||||||
{
|
{
|
||||||
struct cache_member *m = ((struct cache_member *) sb->d) + i;
|
struct cache_member *m = sb->members + i;
|
||||||
|
|
||||||
printf("cache.state\t%s\n", cache_state[CACHE_STATE(m)]);
|
printf("cache.state\t%s\n", cache_state[CACHE_STATE(m)]);
|
||||||
|
|
||||||
|
17
bcache.h
17
bcache.h
@ -30,6 +30,21 @@ typedef __s64 s64;
|
|||||||
(void) (&_max1 == &_max2); \
|
(void) (&_max1 == &_max2); \
|
||||||
_max1 > _max2 ? _max1 : _max2; })
|
_max1 > _max2 ? _max1 : _max2; })
|
||||||
|
|
||||||
|
#define __bkey_idx(_set, _offset) \
|
||||||
|
((_set)->_data + (_offset))
|
||||||
|
|
||||||
|
#define bkey_idx(_set, _offset) \
|
||||||
|
((typeof(&(_set)->start[0])) __bkey_idx((_set), (_offset)))
|
||||||
|
|
||||||
|
#define bkey_next(_k) \
|
||||||
|
((typeof(_k)) __bkey_idx(_k, (_k)->u64s))
|
||||||
|
|
||||||
|
#define __bset_bkey_last(_set) \
|
||||||
|
__bkey_idx((_set), (_set)->keys)
|
||||||
|
|
||||||
|
#define bset_bkey_last(_set) \
|
||||||
|
bkey_idx((_set), (_set)->keys)
|
||||||
|
|
||||||
extern const char * const cache_state[];
|
extern const char * const cache_state[];
|
||||||
extern const char * const replacement_policies[];
|
extern const char * const replacement_policies[];
|
||||||
extern const char * const csum_types[];
|
extern const char * const csum_types[];
|
||||||
@ -115,7 +130,7 @@ char *device_set_failed(const char *dev_uuid);
|
|||||||
#define csum_set(i, type) \
|
#define csum_set(i, type) \
|
||||||
({ \
|
({ \
|
||||||
void *start = ((void *) (i)) + sizeof(uint64_t); \
|
void *start = ((void *) (i)) + sizeof(uint64_t); \
|
||||||
void *end = bset_bkey_last(i); \
|
void *end = __bset_bkey_last(i); \
|
||||||
\
|
\
|
||||||
bch_checksum(type, start, end - start); \
|
bch_checksum(type, start, end - start); \
|
||||||
})
|
})
|
||||||
|
@ -653,7 +653,7 @@ int bcache_status(NihCommand *command, char *const *args)
|
|||||||
|
|
||||||
for (i = 0; i < seq_sb->nr_in_set; i++) {
|
for (i = 0; i < seq_sb->nr_in_set; i++) {
|
||||||
char uuid_str[40];
|
char uuid_str[40];
|
||||||
struct cache_member *m = ((struct cache_member *) seq_sb->d) + i;
|
struct cache_member *m = seq_sb->members + i;
|
||||||
char dev_state[32];
|
char dev_state[32];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user