dm raid: rename variable 'ret' to 'r' to conform to other dm code
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
e83068a5fa
commit
73c6f239a8
@ -225,7 +225,7 @@ static int dev_parms(struct raid_set *rs, char **argv)
|
|||||||
int i;
|
int i;
|
||||||
int rebuild = 0;
|
int rebuild = 0;
|
||||||
int metadata_available = 0;
|
int metadata_available = 0;
|
||||||
int ret = 0;
|
int r = 0;
|
||||||
|
|
||||||
for (i = 0; i < rs->md.raid_disks; i++, argv += 2) {
|
for (i = 0; i < rs->md.raid_disks; i++, argv += 2) {
|
||||||
rs->dev[i].rdev.raid_disk = i;
|
rs->dev[i].rdev.raid_disk = i;
|
||||||
@ -241,12 +241,12 @@ static int dev_parms(struct raid_set *rs, char **argv)
|
|||||||
rs->dev[i].rdev.mddev = &rs->md;
|
rs->dev[i].rdev.mddev = &rs->md;
|
||||||
|
|
||||||
if (strcmp(argv[0], "-")) {
|
if (strcmp(argv[0], "-")) {
|
||||||
ret = dm_get_device(rs->ti, argv[0],
|
r = dm_get_device(rs->ti, argv[0],
|
||||||
dm_table_get_mode(rs->ti->table),
|
dm_table_get_mode(rs->ti->table),
|
||||||
&rs->dev[i].meta_dev);
|
&rs->dev[i].meta_dev);
|
||||||
rs->ti->error = "RAID metadata device lookup failure";
|
rs->ti->error = "RAID metadata device lookup failure";
|
||||||
if (ret)
|
if (r)
|
||||||
return ret;
|
return r;
|
||||||
|
|
||||||
rs->dev[i].rdev.sb_page = alloc_page(GFP_KERNEL);
|
rs->dev[i].rdev.sb_page = alloc_page(GFP_KERNEL);
|
||||||
if (!rs->dev[i].rdev.sb_page)
|
if (!rs->dev[i].rdev.sb_page)
|
||||||
@ -267,12 +267,12 @@ static int dev_parms(struct raid_set *rs, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dm_get_device(rs->ti, argv[1],
|
r = dm_get_device(rs->ti, argv[1],
|
||||||
dm_table_get_mode(rs->ti->table),
|
dm_table_get_mode(rs->ti->table),
|
||||||
&rs->dev[i].data_dev);
|
&rs->dev[i].data_dev);
|
||||||
if (ret) {
|
if (r) {
|
||||||
rs->ti->error = "RAID device lookup failure";
|
rs->ti->error = "RAID device lookup failure";
|
||||||
return ret;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rs->dev[i].meta_dev) {
|
if (rs->dev[i].meta_dev) {
|
||||||
@ -848,7 +848,7 @@ static void super_sync(struct mddev *mddev, struct md_rdev *rdev)
|
|||||||
*/
|
*/
|
||||||
static int super_load(struct md_rdev *rdev, struct md_rdev *refdev)
|
static int super_load(struct md_rdev *rdev, struct md_rdev *refdev)
|
||||||
{
|
{
|
||||||
int ret;
|
int r;
|
||||||
struct dm_raid_superblock *sb;
|
struct dm_raid_superblock *sb;
|
||||||
struct dm_raid_superblock *refsb;
|
struct dm_raid_superblock *refsb;
|
||||||
uint64_t events_sb, events_refsb;
|
uint64_t events_sb, events_refsb;
|
||||||
@ -860,9 +860,9 @@ static int super_load(struct md_rdev *rdev, struct md_rdev *refdev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = read_disk_sb(rdev, rdev->sb_size);
|
r = read_disk_sb(rdev, rdev->sb_size);
|
||||||
if (ret)
|
if (r)
|
||||||
return ret;
|
return r;
|
||||||
|
|
||||||
sb = page_address(rdev->sb_page);
|
sb = page_address(rdev->sb_page);
|
||||||
|
|
||||||
@ -1072,7 +1072,7 @@ static int super_validate(struct raid_set *rs, struct md_rdev *rdev)
|
|||||||
*/
|
*/
|
||||||
static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
|
static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
|
||||||
{
|
{
|
||||||
int ret;
|
int r;
|
||||||
struct raid_dev *dev;
|
struct raid_dev *dev;
|
||||||
struct md_rdev *rdev, *tmp, *freshest;
|
struct md_rdev *rdev, *tmp, *freshest;
|
||||||
struct mddev *mddev = &rs->md;
|
struct mddev *mddev = &rs->md;
|
||||||
@ -1097,9 +1097,9 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
|
|||||||
if (!rdev->meta_bdev)
|
if (!rdev->meta_bdev)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = super_load(rdev, freshest);
|
r = super_load(rdev, freshest);
|
||||||
|
|
||||||
switch (ret) {
|
switch (r) {
|
||||||
case 1:
|
case 1:
|
||||||
freshest = rdev;
|
freshest = rdev;
|
||||||
break;
|
break;
|
||||||
@ -1207,17 +1207,21 @@ static void configure_discard_support(struct dm_target *ti, struct raid_set *rs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct a RAID4/5/6 mapping:
|
* Construct a RAID0/1/10/4/5/6 mapping:
|
||||||
* Args:
|
* Args:
|
||||||
* <raid_type> <#raid_params> <raid_params> \
|
* <raid_type> <#raid_params> <raid_params>{0,} \
|
||||||
* <#raid_devs> { <meta_dev1> <dev1> .. <meta_devN> <devN> }
|
* <#raid_devs> [<meta_dev1> <dev1>]{1,}
|
||||||
*
|
*
|
||||||
* <raid_params> varies by <raid_type>. See 'parse_raid_params' for
|
* <raid_params> varies by <raid_type>. See 'parse_raid_params' for
|
||||||
* details on possible <raid_params>.
|
* details on possible <raid_params>.
|
||||||
|
*
|
||||||
|
* Userspace is free to initialize the metadata devices, hence the superblocks to
|
||||||
|
* enforce recreation based on the passed in table parameters.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret;
|
int r;
|
||||||
struct raid_type *rt;
|
struct raid_type *rt;
|
||||||
unsigned long num_raid_params, num_raid_devs;
|
unsigned long num_raid_params, num_raid_devs;
|
||||||
struct raid_set *rs = NULL;
|
struct raid_set *rs = NULL;
|
||||||
@ -1267,19 +1271,19 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
|||||||
if (IS_ERR(rs))
|
if (IS_ERR(rs))
|
||||||
return PTR_ERR(rs);
|
return PTR_ERR(rs);
|
||||||
|
|
||||||
ret = parse_raid_params(rs, argv, (unsigned)num_raid_params);
|
r = parse_raid_params(rs, argv, (unsigned)num_raid_params);
|
||||||
if (ret)
|
if (r)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
argv += num_raid_params + 1;
|
argv += num_raid_params + 1;
|
||||||
|
|
||||||
ret = dev_parms(rs, argv);
|
r = dev_parms(rs, argv);
|
||||||
if (ret)
|
if (r)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
rs->md.sync_super = super_sync;
|
rs->md.sync_super = super_sync;
|
||||||
ret = analyse_superblocks(ti, rs);
|
r = analyse_superblocks(ti, rs);
|
||||||
if (ret)
|
if (r)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
INIT_WORK(&rs->md.event_work, do_table_event);
|
INIT_WORK(&rs->md.event_work, do_table_event);
|
||||||
@ -1293,18 +1297,18 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
|||||||
|
|
||||||
/* Has to be held on running the array */
|
/* Has to be held on running the array */
|
||||||
mddev_lock_nointr(&rs->md);
|
mddev_lock_nointr(&rs->md);
|
||||||
ret = md_run(&rs->md);
|
r = md_run(&rs->md);
|
||||||
rs->md.in_sync = 0; /* Assume already marked dirty */
|
rs->md.in_sync = 0; /* Assume already marked dirty */
|
||||||
mddev_unlock(&rs->md);
|
mddev_unlock(&rs->md);
|
||||||
|
|
||||||
if (ret) {
|
if (r) {
|
||||||
ti->error = "Fail to run raid array";
|
ti->error = "Fail to run raid array";
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ti->len != rs->md.array_sectors) {
|
if (ti->len != rs->md.array_sectors) {
|
||||||
ti->error = "Array size does not match requested target length";
|
ti->error = "Array size does not match requested target length";
|
||||||
ret = -EINVAL;
|
r = -EINVAL;
|
||||||
goto size_mismatch;
|
goto size_mismatch;
|
||||||
}
|
}
|
||||||
rs->callbacks.congested_fn = raid_is_congested;
|
rs->callbacks.congested_fn = raid_is_congested;
|
||||||
@ -1318,7 +1322,7 @@ size_mismatch:
|
|||||||
bad:
|
bad:
|
||||||
context_free(rs);
|
context_free(rs);
|
||||||
|
|
||||||
return ret;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void raid_dtr(struct dm_target *ti)
|
static void raid_dtr(struct dm_target *ti)
|
||||||
@ -1603,17 +1607,17 @@ static int raid_iterate_devices(struct dm_target *ti,
|
|||||||
{
|
{
|
||||||
struct raid_set *rs = ti->private;
|
struct raid_set *rs = ti->private;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int ret = 0;
|
int r = 0;
|
||||||
|
|
||||||
for (i = 0; !ret && i < rs->md.raid_disks; i++)
|
for (i = 0; !r && i < rs->md.raid_disks; i++)
|
||||||
if (rs->dev[i].data_dev)
|
if (rs->dev[i].data_dev)
|
||||||
ret = fn(ti,
|
r = fn(ti,
|
||||||
rs->dev[i].data_dev,
|
rs->dev[i].data_dev,
|
||||||
0, /* No offset on data devs */
|
0, /* No offset on data devs */
|
||||||
rs->md.dev_sectors,
|
rs->md.dev_sectors,
|
||||||
data);
|
data);
|
||||||
|
|
||||||
return ret;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
|
static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user