本文整理汇总了C++中DMWARN函数的典型用法代码示例。如果您正苦于以下问题:C++ DMWARN函数的具体用法?C++ DMWARN怎么用?C++ DMWARN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DMWARN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ca_load
static int ca_load(struct count_array *ca, struct dm_space_map *sm)
{
int r;
uint32_t count;
dm_block_t nr_blocks, i;
r = dm_sm_get_nr_blocks(sm, &nr_blocks);
if (r)
return r;
BUG_ON(ca->nr != nr_blocks);
DMWARN("Loading debug space map from disk. This may take some time");
for (i = 0; i < nr_blocks; i++) {
r = dm_sm_get_count(sm, i, &count);
if (r) {
DMERR("load failed");
return r;
}
ca_set_count(ca, i, count);
}
DMWARN("Load complete");
return 0;
}
示例2: _get_dirty_log_type
/*
* get_type
* @type_name
*
* Attempt to retrieve the dm_dirty_log_type by name. If not already
* available, attempt to load the appropriate module.
*
* Log modules are named "dm-log-" followed by the 'type_name'.
* Modules may contain multiple types.
* This function will first try the module "dm-log-<type_name>",
* then truncate 'type_name' on the last '-' and try again.
*
* For example, if type_name was "clustered-disk", it would search
* 'dm-log-clustered-disk' then 'dm-log-clustered'.
*
* Returns: dirty_log_type* on success, NULL on failure
*/
static struct dm_dirty_log_type *get_type(const char *type_name)
{
char *p, *type_name_dup;
struct dm_dirty_log_type *log_type;
if (!type_name)
return NULL;
log_type = _get_dirty_log_type(type_name);
if (log_type)
return log_type;
type_name_dup = kstrdup(type_name, GFP_KERNEL);
if (!type_name_dup) {
DMWARN("No memory left to attempt log module load for \"%s\"",
type_name);
return NULL;
}
while (request_module("dm-log-%s", type_name_dup) ||
!(log_type = _get_dirty_log_type(type_name))) {
p = strrchr(type_name_dup, '-');
if (!p)
break;
p[0] = '\0';
}
if (!log_type)
DMWARN("Module for logging type \"%s\" not found.", type_name);
kfree(type_name_dup);
return log_type;
}
示例3: persistent_read_metadata
static int persistent_read_metadata(struct exception_store *store)
{
int r, new_snapshot;
struct pstore *ps = get_info(store);
/*
* Read the snapshot header.
*/
r = read_header(ps, &new_snapshot);
if (r)
return r;
/*
* Do we need to setup a new snapshot ?
*/
if (new_snapshot) {
r = write_header(ps);
if (r) {
DMWARN("write_header failed");
return r;
}
r = zero_area(ps, 0);
if (r) {
DMWARN("zero_area(0) failed");
return r;
}
} else {
/*
* Sanity checks.
*/
if (!ps->valid) {
DMWARN("snapshot is marked invalid");
return -EINVAL;
}
if (ps->version != SNAPSHOT_DISK_VERSION) {
DMWARN("unable to handle snapshot disk version %d",
ps->version);
return -EINVAL;
}
/*
* Read the metadata.
*/
r = read_exceptions(ps);
if (r)
return r;
}
return 0;
}
示例4: build_constructor_string
static int build_constructor_string(struct dm_target *ti,
unsigned argc, char **argv,
char **ctr_str)
{
int i, str_size;
char *str = NULL;
*ctr_str = NULL;
/*
* Determine overall size of the string.
*/
for (i = 0, str_size = 0; i < argc; i++)
str_size += strlen(argv[i]) + 1; /* +1 for space between args */
str_size += 20; /* Max number of chars in a printed u64 number */
str = kzalloc(str_size, GFP_KERNEL);
if (!str) {
DMWARN("Unable to allocate memory for constructor string");
return -ENOMEM;
}
str_size = sprintf(str, "%llu", (unsigned long long)ti->len);
for (i = 0; i < argc; i++)
str_size += sprintf(str + str_size, " %s", argv[i]);
*ctr_str = str;
return str_size;
}
示例5: dm_dirty_log_init
static int __init dm_dirty_log_init(void)
{
int r;
r = dm_dirty_log_type_register(&_core_type);
if (r)
DMWARN("couldn't register core log");
r = dm_dirty_log_type_register(&_disk_type);
if (r) {
DMWARN("couldn't register disk type");
dm_dirty_log_type_unregister(&_core_type);
}
return r;
}
示例6: read_header
static int read_header(struct pstore *ps, int *new_snapshot)
{
int r;
struct disk_header *dh;
r = chunk_io(ps, 0, READ);
if (r)
return r;
dh = (struct disk_header *) ps->area;
if (le32_to_cpu(dh->magic) == 0) {
*new_snapshot = 1;
} else if (le32_to_cpu(dh->magic) == SNAP_MAGIC) {
*new_snapshot = 0;
ps->valid = le32_to_cpu(dh->valid);
ps->version = le32_to_cpu(dh->version);
ps->chunk_size = le32_to_cpu(dh->chunk_size);
} else {
DMWARN("Invalid/corrupt snapshot");
r = -ENXIO;
}
return r;
}
示例7: table_destroy
static void table_destroy(struct dm_table *t)
{
unsigned int i;
/* free the indexes (see dm_table_complete) */
if (t->depth >= 2)
vfree(t->index[t->depth - 2]);
/* free the targets */
for (i = 0; i < t->num_targets; i++) {
struct dm_target *tgt = t->targets + i;
if (tgt->type->dtr)
tgt->type->dtr(tgt);
dm_put_target_type(tgt->type);
}
vfree(t->highs);
/* free the device list */
if (t->devices.next != &t->devices) {
DMWARN("devices still present during destroy: "
"dm_table_remove_device calls missing");
free_devices(&t->devices);
}
kfree(t);
}
示例8: read_header
static int read_header(struct log_c *log)
{
int r;
unsigned long ebits;
r = dm_io_sync_vm(1, &log->header_location, READ,
log->disk_header, &ebits);
if (r)
return r;
header_from_disk(&log->header, log->disk_header);
/* New log required? */
if (log->sync != DEFAULTSYNC || log->header.magic != MIRROR_MAGIC) {
log->header.magic = MIRROR_MAGIC;
log->header.version = MIRROR_DISK_VERSION;
log->header.nr_regions = 0;
}
#ifdef __LITTLE_ENDIAN
if (log->header.version == 1)
log->header.version = 2;
#endif
if (log->header.version != MIRROR_DISK_VERSION) {
DMWARN("incompatible disk log version");
return -EINVAL;
}
return 0;
}
示例9: lock_fs
/*
* Functions to lock and unlock any filesystem running on the
* device.
*/
static int lock_fs(struct mapped_device *md)
{
int r = -ENOMEM;
md->frozen_bdev = bdget_disk(md->disk, 0);
if (!md->frozen_bdev) {
DMWARN("bdget failed in lock_fs");
goto out;
}
WARN_ON(md->frozen_sb);
md->frozen_sb = freeze_bdev(md->frozen_bdev);
if (IS_ERR(md->frozen_sb)) {
r = PTR_ERR(md->frozen_sb);
goto out_bdput;
}
/* don't bdput right now, we don't want the bdev
* to go away while it is locked. We'll bdput
* in unlock_fs
*/
return 0;
out_bdput:
bdput(md->frozen_bdev);
md->frozen_sb = NULL;
md->frozen_bdev = NULL;
out:
return r;
}
示例10: hp_sw_end_io
/*
* hp_sw_end_io - Completion handler for HP path activation.
* @req: path activation request
* @error: scsi-ml error
*
* Check sense data, free request structure, and notify dm that
* pg initialization has completed.
*
* Context: scsi-ml softirq
*
*/
static void hp_sw_end_io(struct request *req, int error)
{
struct dm_path *path = req->end_io_data;
unsigned err_flags = 0;
if (!error) {
DMDEBUG("%s path activation command - success",
path->dev->name);
goto out;
}
if (hp_sw_error_is_retryable(req)) {
DMDEBUG("%s path activation command - retry",
path->dev->name);
err_flags = MP_RETRY;
goto out;
}
DMWARN("%s path activation fail - error=0x%x",
path->dev->name, error);
err_flags = MP_FAIL_PATH;
out:
req->end_io_data = NULL;
__blk_put_request(req->q, req);
dm_pg_init_complete(path, err_flags);
}
示例11: __table_get_device
/**ltl
* 功能: 将目标设备加入到列表中
* 参数: t ->映射表
* ti ->映射目标
* path ->映射目标<major:minor>
* start-> 映射目标相对低层设备的起始偏移量(类似磁盘分区的起始地址)
* len -> 此目标设备在dm设备的长度
* mode -> rw
* result-> 底层设备对象
* 返回值:
* 说明:
*/
static int __table_get_device(struct dm_table *t, struct dm_target *ti,
const char *path, sector_t start, sector_t len,
int mode, struct dm_dev **result)
{
int r;
dev_t dev;
struct dm_dev *dd;
unsigned int major, minor;
BUG_ON(!t);
/* 获取主设备号和次设备号 */
if (sscanf(path, "%u:%u", &major, &minor) == 2) {
/* Extract the major/minor numbers */
dev = MKDEV(major, minor);
if (MAJOR(dev) != major || MINOR(dev) != minor)
return -EOVERFLOW;
} else {
/* convert the path to a device */
if ((r = lookup_device(path, &dev))) /* 根据设备路径/dev/sdb获取<major:minor> */
return r;
}
/* 在列表中查找映射目标 */
dd = find_device(&t->devices, dev);
if (!dd) {
dd = kmalloc(sizeof(*dd), GFP_KERNEL);
if (!dd)
return -ENOMEM;
dd->mode = mode;
dd->bdev = NULL;
/* 打开设备 */
if ((r = open_dev(dd, dev, t->md))) {
kfree(dd);
return r;
}
format_dev_t(dd->name, dev); /* 主设备号次设备号 */
atomic_set(&dd->count, 0);
/* 将目标设备插入到映射表中 */
list_add(&dd->list, &t->devices);
} else if (dd->mode != (mode | dd->mode)) {
r = upgrade_mode(dd, mode, t->md);
if (r)
return r;
}
atomic_inc(&dd->count);
/* 检查区域是否超过设备 */
if (!check_device_area(dd, start, len)) {
DMWARN("device %s too small for target", path);
dm_put_device(ti, dd);
return -EINVAL;
}
*result = dd;
return 0;
}
示例12: disk_ctr
/*----------------------------------------------------------------
* disk log constructor/destructor
*
* argv contains log_device region_size followed optionally by [no]sync
*--------------------------------------------------------------*/
static int disk_ctr(struct dirty_log *log, struct dm_target *ti,
unsigned int argc, char **argv)
{
int r;
size_t size;
struct log_c *lc;
struct dm_dev *dev;
if (argc < 2 || argc > 3) {
DMWARN("wrong number of arguments to disk mirror log");
return -EINVAL;
}
r = dm_get_device(ti, argv[0], 0, 0 /* FIXME */,
FMODE_READ | FMODE_WRITE, &dev);
if (r)
return r;
r = core_ctr(log, ti, argc - 1, argv + 1);
if (r) {
dm_put_device(ti, dev);
return r;
}
lc = (struct log_c *) log->context;
lc->log_dev = dev;
/* setup the disk header fields */
lc->header_location.bdev = lc->log_dev->bdev;
lc->header_location.sector = 0;
lc->header_location.count = 1;
/*
* We can't read less than this amount, even though we'll
* not be using most of this space.
*/
lc->disk_header = vmalloc(1 << SECTOR_SHIFT);
if (!lc->disk_header)
goto bad;
/* setup the disk bitset fields */
lc->bits_location.bdev = lc->log_dev->bdev;
lc->bits_location.sector = LOG_OFFSET;
size = dm_round_up(lc->bitset_uint32_count * sizeof(uint32_t),
1 << SECTOR_SHIFT);
lc->bits_location.count = size >> SECTOR_SHIFT;
lc->disk_bits = vmalloc(size);
if (!lc->disk_bits) {
vfree(lc->disk_header);
goto bad;
}
return 0;
bad:
dm_put_device(ti, lc->log_dev);
core_dtr(log);
return -ENOMEM;
}
示例13: persistent_drop
static void persistent_drop(struct exception_store *store)
{
struct pstore *ps = get_info(store);
ps->valid = 0;
if (write_header(ps))
DMWARN("write header failed");
}
示例14: __table_get_device
/*
* Add a device to the list, or just increment the usage count if
* it's already present.
*/
static int __table_get_device(struct dm_table *t, struct dm_target *ti,
const char *path, sector_t start, sector_t len,
int mode, struct dm_dev **result)
{
int r;
dev_t dev;
struct dm_dev *dd;
unsigned int major, minor;
if (!t)
BUG();
if (sscanf(path, "%u:%u", &major, &minor) == 2) {
/* Extract the major/minor numbers */
dev = MKDEV(major, minor);
if (MAJOR(dev) != major || MINOR(dev) != minor)
return -EOVERFLOW;
} else {
/* convert the path to a device */
if ((r = lookup_device(path, &dev)))
return r;
}
dd = find_device(&t->devices, dev);
if (!dd) {
dd = kmalloc(sizeof(*dd), GFP_KERNEL);
if (!dd)
return -ENOMEM;
dd->mode = mode;
dd->bdev = NULL;
if ((r = open_dev(dd, dev))) {
kfree(dd);
return r;
}
atomic_set(&dd->count, 0);
list_add(&dd->list, &t->devices);
} else if (dd->mode != (mode | dd->mode)) {
r = upgrade_mode(dd, mode);
if (r)
return r;
}
atomic_inc(&dd->count);
if (!check_device_area(dd, start, len)) {
DMWARN("device %s too small for target", path);
dm_put_device(ti, dd);
return -EINVAL;
}
*result = dd;
return 0;
}
示例15: map_request
/*
* Returns:
* DM_MAPIO_* : the request has been processed as indicated
* DM_MAPIO_REQUEUE : the original request needs to be immediately requeued
* < 0 : the request was completed due to failure
*/
static int map_request(struct dm_rq_target_io *tio)
{
int r;
struct dm_target *ti = tio->ti;
struct mapped_device *md = tio->md;
struct request *rq = tio->orig;
struct request *clone = NULL;
blk_status_t ret;
r = ti->type->clone_and_map_rq(ti, rq, &tio->info, &clone);
check_again:
switch (r) {
case DM_MAPIO_SUBMITTED:
/* The target has taken the I/O to submit by itself later */
break;
case DM_MAPIO_REMAPPED:
if (setup_clone(clone, rq, tio, GFP_ATOMIC)) {
/* -ENOMEM */
ti->type->release_clone_rq(clone);
return DM_MAPIO_REQUEUE;
}
/* The target has remapped the I/O so dispatch it */
trace_block_rq_remap(clone->q, clone, disk_devt(dm_disk(md)),
blk_rq_pos(rq));
ret = dm_dispatch_clone_request(clone, rq);
if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) {
blk_rq_unprep_clone(clone);
tio->ti->type->release_clone_rq(clone);
tio->clone = NULL;
if (!rq->q->mq_ops)
r = DM_MAPIO_DELAY_REQUEUE;
else
r = DM_MAPIO_REQUEUE;
goto check_again;
}
break;
case DM_MAPIO_REQUEUE:
/* The target wants to requeue the I/O */
break;
case DM_MAPIO_DELAY_REQUEUE:
/* The target wants to requeue the I/O after a delay */
dm_requeue_original_request(tio, true);
break;
case DM_MAPIO_KILL:
/* The target wants to complete the I/O */
dm_kill_unmapped_request(rq, BLK_STS_IOERR);
break;
default:
DMWARN("unimplemented target map return value: %d", r);
BUG();
}
return r;
}