mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-09 00:00:17 +03:00
deleted unused path to device in get_size, get_blocksize
Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com>
This commit is contained in:
parent
1251ea58a8
commit
b2ffa12074
@ -484,7 +484,7 @@ int cmd_device_resize(int argc, char *argv[])
|
||||
|
||||
char *size_arg = arg_pop();
|
||||
if (!size_arg)
|
||||
size = get_size(dev, dev_fd);
|
||||
size = get_size(dev_fd);
|
||||
else if (bch2_strtoull_h(size_arg, &size))
|
||||
die("invalid size");
|
||||
|
||||
|
||||
@ -671,7 +671,7 @@ static int migrate_fs(const char *fs_path,
|
||||
dev.path = dev_t_to_path(stat.st_dev);
|
||||
dev.fd = xopen(dev.path, O_RDWR);
|
||||
|
||||
opt_set(fs_opts, block_size, get_blocksize(dev.path, dev.fd));
|
||||
opt_set(fs_opts, block_size, get_blocksize(dev.fd));
|
||||
|
||||
char *file_path = mprintf("%s/bcachefs", fs_path);
|
||||
printf("Creating new filesystem on %s in space reserved at %s\n",
|
||||
@ -682,7 +682,7 @@ static int migrate_fs(const char *fs_path,
|
||||
u64 bcachefs_inum;
|
||||
ranges extents = reserve_new_fs_space(file_path,
|
||||
fs_opts.block_size >> 9,
|
||||
get_size(dev.path, dev.fd) / 5,
|
||||
get_size(dev.fd) / 5,
|
||||
&bcachefs_inum, stat.st_dev, force);
|
||||
|
||||
find_superblock_space(extents, format_opts, &dev);
|
||||
|
||||
@ -67,7 +67,7 @@ static u64 min_size(unsigned bucket_size)
|
||||
void bch2_pick_bucket_size(struct bch_opts opts, struct dev_opts *dev)
|
||||
{
|
||||
if (!dev->size)
|
||||
dev->size = get_size(dev->path, dev->fd);
|
||||
dev->size = get_size(dev->fd);
|
||||
|
||||
if (!dev->bucket_size) {
|
||||
if (dev->size < min_size(opts.block_size))
|
||||
@ -155,7 +155,7 @@ struct bch_sb *bch2_format(struct bch_opt_strs fs_opt_strs,
|
||||
|
||||
for (i = devs; i < devs + nr_devs; i++)
|
||||
max_dev_block_size = max(max_dev_block_size,
|
||||
get_blocksize(i->path, i->fd));
|
||||
get_blocksize(i->fd));
|
||||
|
||||
/* calculate block size: */
|
||||
if (!opt_defined(fs_opts, block_size)) {
|
||||
|
||||
2
qcow2.c
2
qcow2.c
@ -72,7 +72,7 @@ static void add_l2(struct qcow2_image *img, u64 src_blk, u64 dst_offset)
|
||||
void qcow2_write_image(int infd, int outfd, ranges *data,
|
||||
unsigned block_size)
|
||||
{
|
||||
u64 image_size = get_size(NULL, infd);
|
||||
u64 image_size = get_size(infd);
|
||||
unsigned l2_size = block_size / sizeof(u64);
|
||||
unsigned l1_size = DIV_ROUND_UP(image_size, (u64) block_size * l2_size);
|
||||
struct qcow2_hdr hdr = { 0 };
|
||||
|
||||
@ -186,7 +186,7 @@ ssize_t read_string_list_or_die(const char *opt, const char * const list[],
|
||||
}
|
||||
|
||||
/* Returns size of file or block device: */
|
||||
u64 get_size(const char *path, int fd)
|
||||
u64 get_size(int fd)
|
||||
{
|
||||
struct stat statbuf = xfstat(fd);
|
||||
|
||||
@ -199,7 +199,7 @@ u64 get_size(const char *path, int fd)
|
||||
}
|
||||
|
||||
/* Returns blocksize, in bytes: */
|
||||
unsigned get_blocksize(const char *path, int fd)
|
||||
unsigned get_blocksize(int fd)
|
||||
{
|
||||
struct stat statbuf = xfstat(fd);
|
||||
|
||||
|
||||
@ -62,8 +62,8 @@ u64 read_file_u64(int, const char *);
|
||||
ssize_t read_string_list_or_die(const char *, const char * const[],
|
||||
const char *);
|
||||
|
||||
u64 get_size(const char *, int);
|
||||
unsigned get_blocksize(const char *, int);
|
||||
u64 get_size(int);
|
||||
unsigned get_blocksize(int);
|
||||
int open_for_format(const char *, bool);
|
||||
|
||||
bool ask_yn(void);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user