From: Takahiro Yasui <tyasui@redhat.com>
To: dm-devel@redhat.com
Cc: Alasdair G Kergon <agk@redhat.com>,
Masami Hiramatsu <mhiramat@redhat.com>
Subject: [RFC][PATCH 2/4] dm-log: unify rw_header to read/write_header
Date: Tue, 25 Nov 2008 19:01:39 -0500 [thread overview]
Message-ID: <492C91E3.5020700@redhat.com> (raw)
rw_header function updates three members of io_req data every time
when I/O is processed. bi_rw and notify.fn are never modified once
they get initialized, and also they can be set in advance.
This patch removes unnecessary update operations.
Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
---
drivers/md/dm-log.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
Index: linux-2.6.28-rc4/drivers/md/dm-log.c
===================================================================
--- linux-2.6.28-rc4.orig/drivers/md/dm-log.c
+++ linux-2.6.28-rc4/drivers/md/dm-log.c
@@ -323,20 +323,13 @@ static void header_from_disk(struct log_
core->nr_regions = le64_to_cpu(disk->nr_regions);
}
-static int rw_header(struct log_c *lc, int rw)
-{
- lc->io_req.bi_rw = rw;
- lc->io_req.mem.ptr.vma = lc->disk_header;
- lc->io_req.notify.fn = NULL;
-
- return dm_io(&lc->io_req, 1, &lc->header_location, NULL);
-}
-
static int read_header(struct log_c *log)
{
int r;
- r = rw_header(log, READ);
+ log->io_req.bi_rw = READ;
+
+ r = dm_io(&log->io_req, 1, &log->header_location, NULL);
if (r)
return r;
@@ -364,8 +357,8 @@ static int read_header(struct log_c *log
static inline int write_header(struct log_c *log)
{
- header_to_disk(&log->header, log->disk_header);
- return rw_header(log, WRITE);
+ log->io_req.bi_rw = WRITE;
+ return dm_io(&log->io_req, 1, &log->header_location, NULL);
}
/*----------------------------------------------------------------
@@ -454,7 +447,10 @@ static int create_log_context(struct dm_
buf_size = dm_round_up((LOG_OFFSET << SECTOR_SHIFT) +
bitset_size, ti->limits.hardsect_size);
lc->header_location.count = buf_size >> SECTOR_SHIFT;
+
lc->io_req.mem.type = DM_IO_VMA;
+ lc->io_req.mem.ptr.vma = lc->disk_header;
+ lc->io_req.notify.fn = NULL;
lc->io_req.client = dm_io_client_create(dm_div_up(buf_size,
PAGE_SIZE));
if (IS_ERR(lc->io_req.client)) {
@@ -636,6 +632,9 @@ static int disk_resume(struct dm_dirty_l
/* set the correct number of regions in the header */
lc->header.nr_regions = lc->region_count;
+ /* update disk headers */
+ header_to_disk(&lc->header, lc->disk_header);
+
/* write the new header */
r = write_header(lc);
if (r) {
next reply other threads:[~2008-11-26 0:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-26 0:01 Takahiro Yasui [this message]
2008-11-28 23:37 ` [RFC][PATCH 2/4] dm-log: unify rw_header to read/write_header Alasdair G Kergon
2008-12-01 7:24 ` Takahiro Yasui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=492C91E3.5020700@redhat.com \
--to=tyasui@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=mhiramat@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.