summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2018-01-15 19:38:18 +0000
committerAlasdair G Kergon <agk@redhat.com>2018-01-15 19:38:18 +0000
commitc90582344d4c04d020899a8ff8857f09368e0a98 (patch)
tree4f56100b89ab5d371d5b580d181a67aeaffa2e6d
parent1f01eaa61200bb1144bb6f424d8df2c77a8b8307 (diff)
downloadlvm2-c90582344d4c04d020899a8ff8857f09368e0a98.tar.gz
device: Add reason to devbuf.
-rw-r--r--lib/device/dev-io.c9
-rw-r--r--lib/device/device.h1
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 38127c71a..514aaca03 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -142,7 +142,7 @@ static int _io_sync(struct device_buffer *devbuf)
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;
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)",
devbuf->write ? "Write" : "Read ", dev_name(where->dev), fd,
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.
@@ -327,10 +327,11 @@ static int _aligned_io(struct device_area *where, char *buffer,
devbuf->where.start = widened.start;
devbuf->where.size = widened.size;
devbuf->write = 0;
+ devbuf->reason = reason;
/* Do we need to read into the bounce buffer? */
if ((!should_write || buffer_was_widened) &&
- !_io(devbuf, reason)) {
+ !_io(devbuf)) {
if (!should_write)
goto_bad;
/* FIXME Handle errors properly! */
@@ -348,7 +349,7 @@ static int _aligned_io(struct device_area *where, char *buffer,
/* ... then we write */
devbuf->write = 1;
- if (!(r = _io(devbuf, reason)))
+ if (!(r = _io(devbuf)))
goto_bad;
_release_devbuf(devbuf);
diff --git a/lib/device/device.h b/lib/device/device.h
index 2a05fd480..d70d3aac5 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -90,6 +90,7 @@ struct device_buffer {
void *malloc_address; /* Start of allocated memory */
void *buf; /* Aligned buffer that contains data within it */
struct device_area where; /* Location of buf */
+ dev_io_reason_t reason;
unsigned write:1; /* 1 if write; 0 if read */
};