mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 07:32:22 +00:00
btrfs-progs: add prefix to zero_blocks
This is a public helper for devices, add the prefix to make it clear. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
2b5d4f2e6f
commit
c7b5f884e0
@ -68,7 +68,10 @@ int device_discard_blocks(int fd, u64 start, u64 len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zero_blocks(int fd, off_t start, size_t len)
|
||||
/*
|
||||
* Write zeros to the given range [start, start + len)
|
||||
*/
|
||||
int device_zero_blocks(int fd, off_t start, size_t len)
|
||||
{
|
||||
char *buf = malloc(len);
|
||||
int ret = 0;
|
||||
@ -104,7 +107,7 @@ static int zero_dev_clamped(int fd, struct btrfs_zoned_device_info *zinfo,
|
||||
if (zinfo && zinfo->model == ZONED_HOST_MANAGED)
|
||||
return zero_zone_blocks(fd, zinfo, start, end - start);
|
||||
|
||||
return zero_blocks(fd, start, end - start);
|
||||
return device_zero_blocks(fd, start, end - start);
|
||||
}
|
||||
|
||||
static int btrfs_wipe_existing_sb(int fd, struct btrfs_zoned_device_info *zinfo)
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define PREP_DEVICE_ZONED (1U << 3)
|
||||
|
||||
int device_discard_blocks(int fd, u64 start, u64 len);
|
||||
int zero_blocks(int fd, off_t start, size_t len);
|
||||
int device_zero_blocks(int fd, off_t start, size_t len);
|
||||
u64 get_partition_size(const char *dev);
|
||||
u64 disk_size(const char *path);
|
||||
u64 btrfs_device_size(int fd, struct stat *st);
|
||||
|
@ -398,15 +398,15 @@ int zero_zone_blocks(int fd, struct btrfs_zoned_device_info *zinfo, off_t start,
|
||||
size_t count;
|
||||
int ret;
|
||||
|
||||
/* Make sure that zero_blocks does not write sequential zones */
|
||||
/* Make sure that device_zero_blocks does not write sequential zones */
|
||||
while (len > 0) {
|
||||
/* Limit zero_blocks to a single zone */
|
||||
/* Limit device_zero_blocks to a single zone */
|
||||
count = min_t(size_t, len, zone_len);
|
||||
if (count > zone_len - (ofst & (zone_len - 1)))
|
||||
count = zone_len - (ofst & (zone_len - 1));
|
||||
|
||||
if (!zone_is_sequential(zinfo, ofst)) {
|
||||
ret = zero_blocks(fd, ofst, count);
|
||||
ret = device_zero_blocks(fd, ofst, count);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user