mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 15:42:23 +00:00
btrfs-progs: update comments for device helpers
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
51c0ece9f6
commit
a2dbbcfe88
@ -89,7 +89,10 @@ int device_zero_blocks(int fd, off_t start, size_t len)
|
||||
|
||||
#define ZERO_DEV_BYTES SZ_2M
|
||||
|
||||
/* don't write outside the device by clamping the region to the device size */
|
||||
/*
|
||||
* Zero blocks in the range from start but not after the given device size.
|
||||
* (On SPARC the disk labels are preserved too.)
|
||||
*/
|
||||
static int zero_dev_clamped(int fd, struct btrfs_zoned_device_info *zinfo,
|
||||
off_t start, ssize_t len, u64 dev_size)
|
||||
{
|
||||
@ -110,6 +113,9 @@ static int zero_dev_clamped(int fd, struct btrfs_zoned_device_info *zinfo,
|
||||
return device_zero_blocks(fd, start, end - start);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find all magic signatures known to blkid and remove them
|
||||
*/
|
||||
static int btrfs_wipe_existing_sb(int fd, struct btrfs_zoned_device_info *zinfo)
|
||||
{
|
||||
const char *off = NULL;
|
||||
@ -173,6 +179,13 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare a device before it's added to the filesystem. Optionally:
|
||||
* - remove old superblocks
|
||||
* - discard
|
||||
* - reset zones
|
||||
* - delete end of the device
|
||||
*/
|
||||
int btrfs_prepare_device(int fd, const char *file, u64 *block_count_ret,
|
||||
u64 max_block_count, unsigned opflags)
|
||||
{
|
||||
|
@ -20,18 +20,28 @@
|
||||
#include "kerncompat.h"
|
||||
#include "sys/stat.h"
|
||||
|
||||
/*
|
||||
* Options for btrfs_prepare_device
|
||||
*/
|
||||
#define PREP_DEVICE_ZERO_END (1U << 0)
|
||||
#define PREP_DEVICE_DISCARD (1U << 1)
|
||||
#define PREP_DEVICE_VERBOSE (1U << 2)
|
||||
#define PREP_DEVICE_ZONED (1U << 3)
|
||||
|
||||
/*
|
||||
* Generic block device helpers
|
||||
*/
|
||||
int device_discard_blocks(int fd, u64 start, u64 len);
|
||||
int device_zero_blocks(int fd, off_t start, size_t len);
|
||||
u64 device_get_partition_size(const char *dev);
|
||||
u64 disk_size(const char *path);
|
||||
int device_get_queue_param(const char *file, const char *param, char *buf, size_t len);
|
||||
|
||||
/*
|
||||
* Updates to devices with btrfs-specific changs
|
||||
*/
|
||||
u64 btrfs_device_size(int fd, struct stat *st);
|
||||
int btrfs_prepare_device(int fd, const char *file, u64 *block_count_ret,
|
||||
u64 max_block_count, unsigned opflags);
|
||||
int device_get_queue_param(const char *file, const char *param, char *buf, size_t len);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user