mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
cleanup: use libdm's dm_sysfs_dir() for sysfs directory throughout
And remove superfluous cmd->sysfs_dir and set_sysfs_dir_path/sysfs_dir_path fn from lvm-globals.[ch].
This commit is contained in:
parent
bb70b38021
commit
657abb08e0
@ -79,14 +79,15 @@ static int _get_env_vars(struct cmd_context *cmd)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _get_sysfs_dir(struct cmd_context *cmd)
|
static void _get_sysfs_dir(struct cmd_context *cmd, char *buf, size_t buf_size)
|
||||||
{
|
{
|
||||||
static char proc_mounts[PATH_MAX];
|
static char proc_mounts[PATH_MAX];
|
||||||
static char *split[4], buffer[PATH_MAX + 16];
|
static char *split[4], buffer[PATH_MAX + 16];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *sys_mnt = NULL;
|
char *sys_mnt = NULL;
|
||||||
|
|
||||||
cmd->sysfs_dir[0] = '\0';
|
*buf = '\0';
|
||||||
|
|
||||||
if (!*cmd->proc_dir) {
|
if (!*cmd->proc_dir) {
|
||||||
log_debug("No proc filesystem found: skipping sysfs detection");
|
log_debug("No proc filesystem found: skipping sysfs detection");
|
||||||
return;
|
return;
|
||||||
@ -119,7 +120,7 @@ static void _get_sysfs_dir(struct cmd_context *cmd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(cmd->sysfs_dir, sys_mnt, sizeof(cmd->sysfs_dir));
|
strncpy(buf, sys_mnt, buf_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _parse_debug_classes(struct cmd_context *cmd)
|
static int _parse_debug_classes(struct cmd_context *cmd)
|
||||||
@ -272,6 +273,7 @@ static int _process_config(struct cmd_context *cmd)
|
|||||||
int64_t pv_min_kb;
|
int64_t pv_min_kb;
|
||||||
const char *lvmetad_socket;
|
const char *lvmetad_socket;
|
||||||
int udev_disabled = 0;
|
int udev_disabled = 0;
|
||||||
|
char sysfs_dir[PATH_MAX];
|
||||||
|
|
||||||
if (!config_def_check(cmd, 0, 0, 0) && find_config_tree_bool(cmd, config_abort_on_errors_CFG)) {
|
if (!config_def_check(cmd, 0, 0, 0) && find_config_tree_bool(cmd, config_abort_on_errors_CFG)) {
|
||||||
log_error("LVM configuration invalid.");
|
log_error("LVM configuration invalid.");
|
||||||
@ -312,10 +314,8 @@ static int _process_config(struct cmd_context *cmd)
|
|||||||
cmd->proc_dir[0] = '\0';
|
cmd->proc_dir[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Use global value of sysfs_dir everywhere instead cmd->sysfs_dir. */
|
_get_sysfs_dir(cmd, sysfs_dir, sizeof(sysfs_dir));
|
||||||
_get_sysfs_dir(cmd);
|
dm_set_sysfs_dir(sysfs_dir);
|
||||||
set_sysfs_dir_path(cmd->sysfs_dir);
|
|
||||||
dm_set_sysfs_dir(cmd->sysfs_dir);
|
|
||||||
|
|
||||||
/* activation? */
|
/* activation? */
|
||||||
cmd->default_settings.activation = find_config_tree_bool(cmd, global_activation_CFG);
|
cmd->default_settings.activation = find_config_tree_bool(cmd, global_activation_CFG);
|
||||||
@ -804,7 +804,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
|
|||||||
* unavailable devices.
|
* unavailable devices.
|
||||||
*/
|
*/
|
||||||
if (find_config_tree_bool(cmd, devices_sysfs_scan_CFG)) {
|
if (find_config_tree_bool(cmd, devices_sysfs_scan_CFG)) {
|
||||||
if ((filters[nr_filt] = sysfs_filter_create(cmd->sysfs_dir)))
|
if ((filters[nr_filt] = sysfs_filter_create()))
|
||||||
nr_filt++;
|
nr_filt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -836,7 +836,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
|
|||||||
|
|
||||||
/* mpath component filter. Optional, non-critical. */
|
/* mpath component filter. Optional, non-critical. */
|
||||||
if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG)) {
|
if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG)) {
|
||||||
if ((filters[nr_filt] = mpath_filter_create(cmd->sysfs_dir)))
|
if ((filters[nr_filt] = mpath_filter_create()))
|
||||||
nr_filt++;
|
nr_filt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,6 @@ struct cmd_context {
|
|||||||
char system_dir[PATH_MAX];
|
char system_dir[PATH_MAX];
|
||||||
char dev_dir[PATH_MAX];
|
char dev_dir[PATH_MAX];
|
||||||
char proc_dir[PATH_MAX];
|
char proc_dir[PATH_MAX];
|
||||||
char sysfs_dir[PATH_MAX]; /* FIXME Use global value instead. */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -127,10 +127,10 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int _md_sysfs_attribute_snprintf(char *path, size_t size,
|
static int _md_sysfs_attribute_snprintf(char *path, size_t size,
|
||||||
const char *sysfs_dir,
|
|
||||||
struct device *blkdev,
|
struct device *blkdev,
|
||||||
const char *attribute)
|
const char *attribute)
|
||||||
{
|
{
|
||||||
|
const char *sysfs_dir = dm_sysfs_dir();
|
||||||
struct stat info;
|
struct stat info;
|
||||||
dev_t dev = blkdev->dev;
|
dev_t dev = blkdev->dev;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -140,7 +140,7 @@ static int _md_sysfs_attribute_snprintf(char *path, size_t size,
|
|||||||
|
|
||||||
if (MAJOR(dev) == blkext_major()) {
|
if (MAJOR(dev) == blkext_major()) {
|
||||||
/* lookup parent MD device from blkext partition */
|
/* lookup parent MD device from blkext partition */
|
||||||
if (!get_primary_dev(sysfs_dir, blkdev, &dev))
|
if (!get_primary_dev(blkdev, &dev))
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,8 +181,8 @@ static int _md_sysfs_attribute_scanf(const char *sysfs_dir,
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (_md_sysfs_attribute_snprintf(path, PATH_MAX, sysfs_dir,
|
if (_md_sysfs_attribute_snprintf(path, PATH_MAX, dev,
|
||||||
dev, attribute_name) < 0)
|
attribute_name) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (!(fp = fopen(path, "r"))) {
|
if (!(fp = fopen(path, "r"))) {
|
||||||
@ -271,8 +271,9 @@ static int dev_md_raid_disks(const char *sysfs_dir, struct device *dev)
|
|||||||
/*
|
/*
|
||||||
* Calculate stripe width of md device using its sysfs files.
|
* Calculate stripe width of md device using its sysfs files.
|
||||||
*/
|
*/
|
||||||
unsigned long dev_md_stripe_width(const char *sysfs_dir, struct device *dev)
|
unsigned long dev_md_stripe_width(struct device *dev)
|
||||||
{
|
{
|
||||||
|
const char *sysfs_dir = dm_sysfs_dir();
|
||||||
unsigned long chunk_size_sectors = 0UL;
|
unsigned long chunk_size_sectors = 0UL;
|
||||||
unsigned long stripe_width_sectors = 0UL;
|
unsigned long stripe_width_sectors = 0UL;
|
||||||
int level, raid_disks, data_disks;
|
int level, raid_disks, data_disks;
|
||||||
@ -332,8 +333,7 @@ int dev_is_md(struct device *dev __attribute__((unused)),
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_md_stripe_width(const char *sysfs_dir __attribute__((unused)),
|
unsigned long dev_md_stripe_width(struct device *dev __attribute__((unused)))
|
||||||
struct device *dev __attribute__((unused)))
|
|
||||||
{
|
{
|
||||||
return 0UL;
|
return 0UL;
|
||||||
}
|
}
|
||||||
|
@ -278,9 +278,9 @@ int _get_partition_type(struct dev_mgr *dm, struct device *d)
|
|||||||
|
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
|
|
||||||
int get_primary_dev(const char *sysfs_dir,
|
int get_primary_dev(const struct device *dev, dev_t *result)
|
||||||
const struct device *dev, dev_t *result)
|
|
||||||
{
|
{
|
||||||
|
const char *sysfs_dir = dm_sysfs_dir();
|
||||||
char path[PATH_MAX+1];
|
char path[PATH_MAX+1];
|
||||||
char temp_path[PATH_MAX+1];
|
char temp_path[PATH_MAX+1];
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
@ -357,10 +357,9 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long _dev_topology_attribute(const char *attribute,
|
static unsigned long _dev_topology_attribute(const char *attribute, struct device *dev)
|
||||||
const char *sysfs_dir,
|
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
|
const char *sysfs_dir = dm_sysfs_dir();
|
||||||
static const char sysfs_fmt_str[] = "%s/dev/block/%d:%d/%s";
|
static const char sysfs_fmt_str[] = "%s/dev/block/%d:%d/%s";
|
||||||
char path[PATH_MAX+1], buffer[64];
|
char path[PATH_MAX+1], buffer[64];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -391,7 +390,7 @@ static unsigned long _dev_topology_attribute(const char *attribute,
|
|||||||
log_sys_error("stat", path);
|
log_sys_error("stat", path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!get_primary_dev(sysfs_dir, dev, &primary))
|
if (!get_primary_dev(dev, &primary))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* get attribute from partition's primary device */
|
/* get attribute from partition's primary device */
|
||||||
@ -434,75 +433,59 @@ out:
|
|||||||
return result >> SECTOR_SHIFT;
|
return result >> SECTOR_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_alignment_offset(const char *sysfs_dir,
|
unsigned long dev_alignment_offset(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return _dev_topology_attribute("alignment_offset",
|
return _dev_topology_attribute("alignment_offset", dev);
|
||||||
sysfs_dir, dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_minimum_io_size(const char *sysfs_dir,
|
unsigned long dev_minimum_io_size(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return _dev_topology_attribute("queue/minimum_io_size",
|
return _dev_topology_attribute("queue/minimum_io_size", dev);
|
||||||
sysfs_dir, dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_optimal_io_size(const char *sysfs_dir,
|
unsigned long dev_optimal_io_size(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return _dev_topology_attribute("queue/optimal_io_size",
|
return _dev_topology_attribute("queue/optimal_io_size", dev);
|
||||||
sysfs_dir, dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_discard_max_bytes(const char *sysfs_dir,
|
unsigned long dev_discard_max_bytes(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return _dev_topology_attribute("queue/discard_max_bytes",
|
return _dev_topology_attribute("queue/discard_max_bytes", dev);
|
||||||
sysfs_dir, dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_discard_granularity(const char *sysfs_dir,
|
unsigned long dev_discard_granularity(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return _dev_topology_attribute("queue/discard_granularity",
|
return _dev_topology_attribute("queue/discard_granularity", dev);
|
||||||
sysfs_dir, dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int get_primary_dev(const char *sysfs_dir,
|
int get_primary_dev(struct device *dev, dev_t *result)
|
||||||
struct device *dev, dev_t *result)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_alignment_offset(const char *sysfs_dir,
|
unsigned long dev_alignment_offset(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return 0UL;
|
return 0UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_minimum_io_size(const char *sysfs_dir,
|
unsigned long dev_minimum_io_size(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return 0UL;
|
return 0UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_optimal_io_size(const char *sysfs_dir,
|
unsigned long dev_optimal_io_size(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return 0UL;
|
return 0UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_discard_max_bytes(const char *sysfs_dir,
|
unsigned long dev_discard_max_bytes(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return 0UL;
|
return 0UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dev_discard_granularity(const char *sysfs_dir,
|
unsigned long dev_discard_granularity(struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
return 0UL;
|
return 0UL;
|
||||||
}
|
}
|
||||||
|
@ -103,26 +103,16 @@ const char *dev_name_confirmed(struct device *dev, int quiet);
|
|||||||
int dev_is_md(struct device *dev, uint64_t *sb);
|
int dev_is_md(struct device *dev, uint64_t *sb);
|
||||||
int dev_is_swap(struct device *dev, uint64_t *signature);
|
int dev_is_swap(struct device *dev, uint64_t *signature);
|
||||||
int dev_is_luks(struct device *dev, uint64_t *signature);
|
int dev_is_luks(struct device *dev, uint64_t *signature);
|
||||||
unsigned long dev_md_stripe_width(const char *sysfs_dir, struct device *dev);
|
unsigned long dev_md_stripe_width(struct device *dev);
|
||||||
|
|
||||||
int is_partitioned_dev(struct device *dev);
|
int is_partitioned_dev(struct device *dev);
|
||||||
|
|
||||||
int get_primary_dev(const char *sysfs_dir,
|
int get_primary_dev(const struct device *dev, dev_t *result);
|
||||||
const struct device *dev, dev_t *result);
|
|
||||||
|
|
||||||
unsigned long dev_alignment_offset(const char *sysfs_dir,
|
unsigned long dev_alignment_offset(struct device *dev);
|
||||||
struct device *dev);
|
unsigned long dev_minimum_io_size(struct device *dev);
|
||||||
|
unsigned long dev_optimal_io_size(struct device *dev);
|
||||||
unsigned long dev_minimum_io_size(const char *sysfs_dir,
|
unsigned long dev_discard_max_bytes(struct device *dev);
|
||||||
struct device *dev);
|
unsigned long dev_discard_granularity(struct device *dev);
|
||||||
|
|
||||||
unsigned long dev_optimal_io_size(const char *sysfs_dir,
|
|
||||||
struct device *dev);
|
|
||||||
|
|
||||||
unsigned long dev_discard_max_bytes(const char *sysfs_dir,
|
|
||||||
struct device *dev);
|
|
||||||
|
|
||||||
unsigned long dev_discard_granularity(const char *sysfs_dir,
|
|
||||||
struct device *dev);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,7 +119,7 @@ static int dev_is_mpath(struct dev_filter *f, struct device *dev)
|
|||||||
char path[PATH_MAX+1];
|
char path[PATH_MAX+1];
|
||||||
char parent_name[PATH_MAX+1];
|
char parent_name[PATH_MAX+1];
|
||||||
struct stat info;
|
struct stat info;
|
||||||
const char *sysfs_dir = f->private;
|
const char *sysfs_dir = dm_sysfs_dir();
|
||||||
int major, minor;
|
int major, minor;
|
||||||
|
|
||||||
/* Limit this filter only to SCSI devices */
|
/* Limit this filter only to SCSI devices */
|
||||||
@ -176,8 +176,9 @@ static void _destroy(struct dev_filter *f)
|
|||||||
dm_free(f);
|
dm_free(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dev_filter *mpath_filter_create(const char *sysfs_dir)
|
struct dev_filter *mpath_filter_create(void)
|
||||||
{
|
{
|
||||||
|
const char *sysfs_dir = dm_sysfs_dir();
|
||||||
struct dev_filter *f;
|
struct dev_filter *f;
|
||||||
|
|
||||||
if (!*sysfs_dir) {
|
if (!*sysfs_dir) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "dev-cache.h"
|
#include "dev-cache.h"
|
||||||
|
|
||||||
struct dev_filter *mpath_filter_create(const char *sysfs_dir);
|
struct dev_filter *mpath_filter_create(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -290,8 +290,9 @@ static void _destroy(struct dev_filter *f)
|
|||||||
dm_pool_destroy(ds->mem);
|
dm_pool_destroy(ds->mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dev_filter *sysfs_filter_create(const char *sysfs_dir)
|
struct dev_filter *sysfs_filter_create(void)
|
||||||
{
|
{
|
||||||
|
const char *sysfs_dir = dm_sysfs_dir();
|
||||||
char sys_block[PATH_MAX];
|
char sys_block[PATH_MAX];
|
||||||
unsigned sysfs_depth;
|
unsigned sysfs_depth;
|
||||||
struct dm_pool *mem;
|
struct dm_pool *mem;
|
||||||
|
@ -18,6 +18,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "dev-cache.h"
|
#include "dev-cache.h"
|
||||||
|
|
||||||
struct dev_filter *sysfs_filter_create(const char *sysfs_dir);
|
struct dev_filter *sysfs_filter_create(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -76,7 +76,7 @@ int dev_subsystem_part_major(const struct device *dev)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if ((MAJOR(dev->dev) == _blkext_major) &&
|
if ((MAJOR(dev->dev) == _blkext_major) &&
|
||||||
(get_primary_dev(sysfs_dir_path(), dev, &primary_dev)) &&
|
(get_primary_dev(dev, &primary_dev)) &&
|
||||||
(MAJOR(primary_dev) == _md_major))
|
(MAJOR(primary_dev) == _md_major))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignm
|
|||||||
* Align to stripe-width of underlying md device if present
|
* Align to stripe-width of underlying md device if present
|
||||||
*/
|
*/
|
||||||
if (find_config_tree_bool(pv->fmt->cmd, devices_md_chunk_alignment_CFG)) {
|
if (find_config_tree_bool(pv->fmt->cmd, devices_md_chunk_alignment_CFG)) {
|
||||||
temp_pe_align = dev_md_stripe_width(pv->fmt->cmd->sysfs_dir, pv->dev);
|
temp_pe_align = dev_md_stripe_width(pv->dev);
|
||||||
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
|
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
|
||||||
pv->pe_align = temp_pe_align;
|
pv->pe_align = temp_pe_align;
|
||||||
}
|
}
|
||||||
@ -97,11 +97,11 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignm
|
|||||||
* (e.g. MD's stripe width)
|
* (e.g. MD's stripe width)
|
||||||
*/
|
*/
|
||||||
if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_detection_CFG)) {
|
if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_detection_CFG)) {
|
||||||
temp_pe_align = dev_minimum_io_size(pv->fmt->cmd->sysfs_dir, pv->dev);
|
temp_pe_align = dev_minimum_io_size(pv->dev);
|
||||||
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
|
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
|
||||||
pv->pe_align = temp_pe_align;
|
pv->pe_align = temp_pe_align;
|
||||||
|
|
||||||
temp_pe_align = dev_optimal_io_size(pv->fmt->cmd->sysfs_dir, pv->dev);
|
temp_pe_align = dev_optimal_io_size(pv->dev);
|
||||||
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
|
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
|
||||||
pv->pe_align = temp_pe_align;
|
pv->pe_align = temp_pe_align;
|
||||||
}
|
}
|
||||||
@ -129,8 +129,7 @@ unsigned long set_pe_align_offset(struct physical_volume *pv,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_offset_detection_CFG)) {
|
if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_offset_detection_CFG)) {
|
||||||
int align_offset = dev_alignment_offset(pv->fmt->cmd->sysfs_dir,
|
int align_offset = dev_alignment_offset(pv->dev);
|
||||||
pv->dev);
|
|
||||||
/* must handle a -1 alignment_offset; means dev is misaligned */
|
/* must handle a -1 alignment_offset; means dev is misaligned */
|
||||||
if (align_offset < 0)
|
if (align_offset < 0)
|
||||||
align_offset = 0;
|
align_offset = 0;
|
||||||
|
@ -216,8 +216,8 @@ int discard_pv_segment(struct pv_segment *peg, uint32_t discard_area_reduction)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dev_discard_max_bytes(peg->pv->fmt->cmd->sysfs_dir, peg->pv->dev) ||
|
if (!dev_discard_max_bytes(peg->pv->dev) ||
|
||||||
!dev_discard_granularity(peg->pv->fmt->cmd->sysfs_dir, peg->pv->dev))
|
!dev_discard_granularity(peg->pv->dev))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
discard_offset_sectors = (peg->pe + peg->lvseg->area_len - discard_area_reduction) *
|
discard_offset_sectors = (peg->pe + peg->lvseg->area_len - discard_area_reduction) *
|
||||||
|
Loading…
Reference in New Issue
Block a user