All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: dm-devel@redhat.com
Cc: Alasdair G Kergon <agk@redhat.com>
Subject: [PATCH 3/4] Refactor set_chunk_size.
Date: Mon, 3 Aug 2009 21:44:04 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0908032143200.6002@hs20-bc2-1.build.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0908032139440.6002@hs20-bc2-1.build.redhat.com>

Break the function set_chunk_size to two functions.

It doesn't change functionality, just makes the following patch simpler
and avoids code duplication.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/md/dm-exception-store.c |    7 +++++++
 drivers/md/dm-exception-store.h |    4 ++++
 2 files changed, 11 insertions(+)

Index: linux-2.6.31-rc5-devel/drivers/md/dm-exception-store.c
===================================================================
--- linux-2.6.31-rc5-devel.orig/drivers/md/dm-exception-store.c	2009-08-04 03:00:55.000000000 +0200
+++ linux-2.6.31-rc5-devel/drivers/md/dm-exception-store.c	2009-08-04 03:01:32.000000000 +0200
@@ -171,6 +171,13 @@ static int set_chunk_size(struct dm_exce
 	 */
 	chunk_size_ulong = round_up(chunk_size_ulong, PAGE_SIZE >> 9);
 
+	return dm_exception_store_set_chunk_size(store, chunk_size_ulong, error);
+}
+
+int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
+				      unsigned long chunk_size_ulong,
+				      char **error)
+{
 	/* Check chunk_size is a power of 2 */
 	if (!is_power_of_2(chunk_size_ulong)) {
 		*error = "Chunk size is not a power of 2";
Index: linux-2.6.31-rc5-devel/drivers/md/dm-exception-store.h
===================================================================
--- linux-2.6.31-rc5-devel.orig/drivers/md/dm-exception-store.h	2009-08-04 03:00:55.000000000 +0200
+++ linux-2.6.31-rc5-devel/drivers/md/dm-exception-store.h	2009-08-04 03:01:32.000000000 +0200
@@ -168,6 +168,10 @@ static inline chunk_t sector_to_chunk(st
 int dm_exception_store_type_register(struct dm_exception_store_type *type);
 int dm_exception_store_type_unregister(struct dm_exception_store_type *type);
 
+int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
+				      unsigned long chunk_size_ulong,
+				      char **error);
+
 int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
 			      unsigned *args_used,
 			      struct dm_exception_store **store);

  reply	other threads:[~2009-08-04  1:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-04  1:38 [PATCH 0/4] Fix corruption of snapshot store on invalidation Mikulas Patocka
2009-08-04  1:39 ` [PATCH 1/4] Refactor chunk_io Mikulas Patocka
2009-08-04  1:43   ` [PATCH 2/4] Use a separate memory area for the header Mikulas Patocka
2009-08-04  1:44     ` Mikulas Patocka [this message]
2009-08-04  1:44       ` [PATCH 4/4] Check on-disk chunk size Mikulas Patocka

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=Pine.LNX.4.64.0908032143200.6002@hs20-bc2-1.build.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@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.