All of lore.kernel.org
 help / color / mirror / Atom feed
From: wysochanski@sourceware.org <wysochanski@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 lib/device/dev-io.c lib/device/device.h l ...
Date: 19 Apr 2007 02:10:42 -0000	[thread overview]
Message-ID: <20070419021042.2013.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski at sourceware.org	2007-04-19 03:10:42

Modified files:
	lib/device     : dev-io.c device.h 
	lib/config     : config.c 
	.              : WHATS_NEW 

Log message:
	Add dev_read_circular, read 2 regions on same device.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-io.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.h.diff?cvsroot=lvm2&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.595&r2=1.596

--- LVM2/lib/device/dev-io.c	2007/01/25 14:37:47	1.56
+++ LVM2/lib/device/dev-io.c	2007/04/19 02:10:41	1.57
@@ -564,6 +564,35 @@
 	return _aligned_io(&where, buffer, 0);
 }
 
+/*
+ * Read from 'dev' into 'buf', possibly in 2 distinct regions, denoted
+ * by (offset,len) and (offset2,len2).  Thus, the total size of
+ * 'buf' should be len+len2.
+ */
+int dev_read_circular(struct device *dev, uint64_t offset, size_t len,
+		      uint64_t offset2, size_t len2, void *buf)
+{
+	if (!dev_read(dev, offset, len, buf)) {
+		log_error("Read from %s failed", dev_name(dev));
+		return 0;
+	}
+
+	/*
+	 * The second region is optional, and allows for
+	 * a circular buffer on the device.
+	 */
+	if (!len2)
+		return 1;
+
+	if (!dev_read(dev, offset2, len2, buf + len)) {
+		log_error("Circular read from %s failed",
+			  dev_name(dev));
+		return 0;
+	}
+
+	return 1;
+}
+
 /* FIXME If O_DIRECT can't extend file, dev_extend first; dev_truncate after.
  *       But fails if concurrent processes writing
  */
--- LVM2/lib/device/device.h	2006/05/11 18:39:24	1.32
+++ LVM2/lib/device/device.h	2007/04/19 02:10:41	1.33
@@ -78,6 +78,8 @@
 const char *dev_name(const struct device *dev);
 
 int dev_read(struct device *dev, uint64_t offset, size_t len, void *buffer);
+int dev_read_circular(struct device *dev, uint64_t offset, size_t len,
+		      uint64_t offset2, size_t len2, void *buf);
 int dev_write(struct device *dev, uint64_t offset, size_t len, void *buffer);
 int dev_append(struct device *dev, size_t len, void *buffer);
 int dev_set(struct device *dev, uint64_t offset, size_t len, int value);
--- LVM2/lib/config/config.c	2007/03/08 19:22:52	1.54
+++ LVM2/lib/config/config.c	2007/04/19 02:10:42	1.55
@@ -210,18 +210,10 @@
 			stack;
 			return 0;
 		}
-		if (!dev_read(dev, (uint64_t) offset, size, buf)) {
-			log_error("Read from %s failed", dev_name(dev));
+		if (!dev_read_circular(dev, (uint64_t) offset, size,
+				       (uint64_t) offset2, size2, buf)) {
 			goto out;
 		}
-		if (size2) {
-			if (!dev_read(dev, (uint64_t) offset2, size2,
-				      buf + size)) {
-				log_error("Circular read from %s failed",
-					  dev_name(dev));
-				goto out;
-			}
-		}
 		p->fb = buf;
 	}
 
--- LVM2/WHATS_NEW	2007/03/30 21:00:26	1.595
+++ LVM2/WHATS_NEW	2007/04/19 02:10:42	1.596
@@ -1,5 +1,6 @@
 Version 2.02.25 -
 =================================
+  Add dev_read_circular.
   Add pvck command stub.
   Update lists of attribute characters in man pages.
   Change cling alloc policy attribute character from 'C' to l'.



                 reply	other threads:[~2007-04-19  2:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070419021042.2013.qmail@sourceware.org \
    --to=wysochanski@sourceware.org \
    --cc=lvm-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.