mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-10 00:00:24 +03:00
Fix clang build errors
Some checks failed
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
Some checks failed
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
8471005b9f
commit
ffe083c31d
@ -104,8 +104,9 @@ int cmd_strip_alloc(int argc, char *argv[])
|
|||||||
|
|
||||||
struct bch_opts opts = bch2_opts_empty();
|
struct bch_opts opts = bch2_opts_empty();
|
||||||
opt_set(opts, nostart, true);
|
opt_set(opts, nostart, true);
|
||||||
|
struct bch_fs *c;
|
||||||
reopen:
|
reopen:
|
||||||
struct bch_fs *c = bch2_fs_open(&devs, &opts);
|
c = bch2_fs_open(&devs, &opts);
|
||||||
int ret = PTR_ERR_OR_ZERO(c);
|
int ret = PTR_ERR_OR_ZERO(c);
|
||||||
if (ret)
|
if (ret)
|
||||||
die("Error opening filesystem: %s", bch2_err_str(ret));
|
die("Error opening filesystem: %s", bch2_err_str(ret));
|
||||||
|
|||||||
@ -439,40 +439,38 @@ static void link_file_data(struct bch_fs *c,
|
|||||||
fiemap_iter_exit(&iter);
|
fiemap_iter_exit(&iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct range align_range(struct range r, unsigned bs)
|
||||||
|
{
|
||||||
|
r.start = round_down(r.start, bs);
|
||||||
|
r.end = round_up(r.end, bs);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct range seek_data(int fd, u64 i_size, loff_t o)
|
||||||
|
{
|
||||||
|
s64 s = lseek(fd, o, SEEK_DATA);
|
||||||
|
if (s < 0 && errno == ENXIO)
|
||||||
|
return (struct range) {};
|
||||||
|
if (s < 0)
|
||||||
|
die("lseek error: %m");
|
||||||
|
|
||||||
|
s64 e = lseek(fd, s, SEEK_HOLE);
|
||||||
|
if (e < 0 && errno == ENXIO)
|
||||||
|
e = i_size;
|
||||||
|
if (e < 0)
|
||||||
|
die("lseek error: %m");
|
||||||
|
|
||||||
|
return (struct range) { s, e };
|
||||||
|
}
|
||||||
|
|
||||||
static struct range seek_data_aligned(int fd, u64 i_size, loff_t o, unsigned bs)
|
static struct range seek_data_aligned(int fd, u64 i_size, loff_t o, unsigned bs)
|
||||||
{
|
{
|
||||||
struct range seek_data(int fd, loff_t o)
|
struct range r = align_range(seek_data(fd, i_size, o), bs);
|
||||||
{
|
|
||||||
s64 s = lseek(fd, o, SEEK_DATA);
|
|
||||||
if (s < 0 && errno == ENXIO)
|
|
||||||
return (struct range) {};
|
|
||||||
if (s < 0)
|
|
||||||
die("lseek error: %m");
|
|
||||||
|
|
||||||
s64 e = lseek(fd, s, SEEK_HOLE);
|
|
||||||
if (e < 0 && errno == ENXIO)
|
|
||||||
e = i_size;
|
|
||||||
if (e < 0)
|
|
||||||
die("lseek error: %m");
|
|
||||||
|
|
||||||
return (struct range) { s, e };
|
|
||||||
}
|
|
||||||
|
|
||||||
struct range __seek_data_aligned(int fd, loff_t o, unsigned bs)
|
|
||||||
{
|
|
||||||
struct range r = seek_data(fd, o);
|
|
||||||
|
|
||||||
r.start = round_down(r.start, bs);
|
|
||||||
r.end = round_up(r.end, bs);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct range r = __seek_data_aligned(fd, o, bs);
|
|
||||||
if (!r.end)
|
if (!r.end)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
struct range n = __seek_data_aligned(fd, r.end, bs);
|
struct range n = align_range(seek_data(fd, i_size, r.end), bs);
|
||||||
if (!n.end || r.end < n.start)
|
if (!n.end || r.end < n.start)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -482,38 +480,30 @@ static struct range seek_data_aligned(int fd, u64 i_size, loff_t o, unsigned bs)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct range seek_mismatch(const char *buf1, const char *buf2,
|
||||||
|
unsigned o, unsigned len)
|
||||||
|
{
|
||||||
|
while (o < len && buf1[o] == buf2[o])
|
||||||
|
o++;
|
||||||
|
|
||||||
|
if (o == len)
|
||||||
|
return (struct range) {};
|
||||||
|
|
||||||
|
unsigned s = o;
|
||||||
|
while (o < len && buf1[o] != buf2[o])
|
||||||
|
o++;
|
||||||
|
|
||||||
|
return (struct range) { s, o };
|
||||||
|
}
|
||||||
|
|
||||||
static struct range seek_mismatch_aligned(const char *buf1, const char *buf2,
|
static struct range seek_mismatch_aligned(const char *buf1, const char *buf2,
|
||||||
unsigned offset, unsigned len,
|
unsigned offset, unsigned len,
|
||||||
unsigned bs)
|
unsigned bs)
|
||||||
{
|
{
|
||||||
struct range seek_mismatch(unsigned o)
|
struct range r = align_range(seek_mismatch(buf1, buf2, offset, len), bs);
|
||||||
{
|
|
||||||
while (o < len && buf1[o] == buf2[o])
|
|
||||||
o++;
|
|
||||||
|
|
||||||
if (o == len)
|
|
||||||
return (struct range) {};
|
|
||||||
|
|
||||||
unsigned s = o;
|
|
||||||
while (o < len && buf1[o] != buf2[o])
|
|
||||||
o++;
|
|
||||||
|
|
||||||
return (struct range) { s, o };
|
|
||||||
}
|
|
||||||
|
|
||||||
struct range __seek_mismatch_aligned(unsigned o)
|
|
||||||
{
|
|
||||||
struct range r = seek_mismatch(o);
|
|
||||||
|
|
||||||
r.start = round_down(r.start, bs);
|
|
||||||
r.end = round_up(r.end, bs);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct range r = __seek_mismatch_aligned(offset);
|
|
||||||
if (r.end)
|
if (r.end)
|
||||||
while (true) {
|
while (true) {
|
||||||
struct range n = __seek_mismatch_aligned(r.end);
|
struct range n = align_range(seek_mismatch(buf1, buf2, r.end, len), bs);
|
||||||
if (!n.end || r.end < n.start)
|
if (!n.end || r.end < n.start)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,7 @@ struct super_block {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static inline void evict_inodes(struct super_block *sb) {}
|
static inline void evict_inodes(struct super_block *sb) {}
|
||||||
static inline int sync_filesystem(struct super_block *) { return 0; }
|
static inline int sync_filesystem(struct super_block *sb) { return 0; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* File types
|
* File types
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user