mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
device: Add reason to devbuf.
This commit is contained in:
parent
1f01eaa612
commit
c90582344d
@ -142,7 +142,7 @@ static int _io_sync(struct device_buffer *devbuf)
|
|||||||
return (total == (size_t) where->size);
|
return (total == (size_t) where->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _io(struct device_buffer *devbuf, dev_io_reason_t reason)
|
static int _io(struct device_buffer *devbuf)
|
||||||
{
|
{
|
||||||
struct device_area *where = &devbuf->where;
|
struct device_area *where = &devbuf->where;
|
||||||
int fd = dev_fd(where->dev);
|
int fd = dev_fd(where->dev);
|
||||||
@ -156,7 +156,7 @@ static int _io(struct device_buffer *devbuf, dev_io_reason_t reason)
|
|||||||
log_debug_io("%s %s(fd %d):%8" PRIu64 " bytes (sync) at %" PRIu64 "%s (for %s)",
|
log_debug_io("%s %s(fd %d):%8" PRIu64 " bytes (sync) at %" PRIu64 "%s (for %s)",
|
||||||
devbuf->write ? "Write" : "Read ", dev_name(where->dev), fd,
|
devbuf->write ? "Write" : "Read ", dev_name(where->dev), fd,
|
||||||
where->size, (uint64_t) where->start,
|
where->size, (uint64_t) where->start,
|
||||||
(devbuf->write && test_mode()) ? " (test mode - suppressed)" : "", _reason_text(reason));
|
(devbuf->write && test_mode()) ? " (test mode - suppressed)" : "", _reason_text(devbuf->reason));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip all writes in test mode.
|
* Skip all writes in test mode.
|
||||||
@ -327,10 +327,11 @@ static int _aligned_io(struct device_area *where, char *buffer,
|
|||||||
devbuf->where.start = widened.start;
|
devbuf->where.start = widened.start;
|
||||||
devbuf->where.size = widened.size;
|
devbuf->where.size = widened.size;
|
||||||
devbuf->write = 0;
|
devbuf->write = 0;
|
||||||
|
devbuf->reason = reason;
|
||||||
|
|
||||||
/* Do we need to read into the bounce buffer? */
|
/* Do we need to read into the bounce buffer? */
|
||||||
if ((!should_write || buffer_was_widened) &&
|
if ((!should_write || buffer_was_widened) &&
|
||||||
!_io(devbuf, reason)) {
|
!_io(devbuf)) {
|
||||||
if (!should_write)
|
if (!should_write)
|
||||||
goto_bad;
|
goto_bad;
|
||||||
/* FIXME Handle errors properly! */
|
/* FIXME Handle errors properly! */
|
||||||
@ -348,7 +349,7 @@ static int _aligned_io(struct device_area *where, char *buffer,
|
|||||||
|
|
||||||
/* ... then we write */
|
/* ... then we write */
|
||||||
devbuf->write = 1;
|
devbuf->write = 1;
|
||||||
if (!(r = _io(devbuf, reason)))
|
if (!(r = _io(devbuf)))
|
||||||
goto_bad;
|
goto_bad;
|
||||||
|
|
||||||
_release_devbuf(devbuf);
|
_release_devbuf(devbuf);
|
||||||
|
@ -90,6 +90,7 @@ struct device_buffer {
|
|||||||
void *malloc_address; /* Start of allocated memory */
|
void *malloc_address; /* Start of allocated memory */
|
||||||
void *buf; /* Aligned buffer that contains data within it */
|
void *buf; /* Aligned buffer that contains data within it */
|
||||||
struct device_area where; /* Location of buf */
|
struct device_area where; /* Location of buf */
|
||||||
|
dev_io_reason_t reason;
|
||||||
unsigned write:1; /* 1 if write; 0 if read */
|
unsigned write:1; /* 1 if write; 0 if read */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user