mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[PATCH] dm: extract device limit setting
Separate the setting of device I/O limits from dm_get_device(). dm-loop will use this. Signed-off-by: Bryn Reeves <breeves@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
9faf400f7e
commit
3cb4021453
2 changed files with 53 additions and 43 deletions
|
@ -522,14 +522,9 @@ static int __table_get_device(struct dm_table *t, struct dm_target *ti,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
|
||||||
int dm_get_device(struct dm_target *ti, const char *path, sector_t start,
|
|
||||||
sector_t len, int mode, struct dm_dev **result)
|
|
||||||
{
|
{
|
||||||
int r = __table_get_device(ti->table, ti, path,
|
request_queue_t *q = bdev_get_queue(bdev);
|
||||||
start, len, mode, result);
|
|
||||||
if (!r) {
|
|
||||||
request_queue_t *q = bdev_get_queue((*result)->bdev);
|
|
||||||
struct io_restrictions *rs = &ti->limits;
|
struct io_restrictions *rs = &ti->limits;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -572,6 +567,16 @@ int dm_get_device(struct dm_target *ti, const char *path, sector_t start,
|
||||||
|
|
||||||
rs->no_cluster |= !test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
|
rs->no_cluster |= !test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(dm_set_device_limits);
|
||||||
|
|
||||||
|
int dm_get_device(struct dm_target *ti, const char *path, sector_t start,
|
||||||
|
sector_t len, int mode, struct dm_dev **result)
|
||||||
|
{
|
||||||
|
int r = __table_get_device(ti->table, ti, path,
|
||||||
|
start, len, mode, result);
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
dm_set_device_limits(ti, (*result)->bdev);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,11 @@ typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode,
|
||||||
|
|
||||||
void dm_error(const char *message);
|
void dm_error(const char *message);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Combine device limits.
|
||||||
|
*/
|
||||||
|
void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constructors should call these functions to ensure destination devices
|
* Constructors should call these functions to ensure destination devices
|
||||||
* are opened/closed correctly.
|
* are opened/closed correctly.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue