All of lore.kernel.org
 help / color / mirror / Atom feed
From: agk@sourceware.org
To: dm-cvs@sourceware.org, dm-devel@redhat.com
Subject: device-mapper/lib/ioctl libdm-iface.c
Date: 5 Dec 2007 16:24:41 -0000	[thread overview]
Message-ID: <20071205162441.26547.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/dm
Module name:	device-mapper
Changes by:	agk@sourceware.org	2007-12-05 16:24:41

Modified files:
	lib/ioctl      : libdm-iface.c 

Log message:
	work out device name to use for read ahead request

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/ioctl/libdm-iface.c.diff?cvsroot=dm&r1=1.49&r2=1.50

--- device-mapper/lib/ioctl/libdm-iface.c	2007/12/03 22:48:36	1.49
+++ device-mapper/lib/ioctl/libdm-iface.c	2007/12/05 16:24:41	1.50
@@ -922,7 +922,29 @@
 
 uint32_t dm_task_get_read_ahead(const struct dm_task *dmt, uint32_t *read_ahead)
 {              
-	return get_dev_node_read_ahead(dmt->dev_name, read_ahead);
+	const char *dev_name;
+
+	*read_ahead = 0;
+
+#ifdef DM_COMPAT
+	/* Not supporting this */
+        if (_dm_version == 1)
+                return 1;
+#endif  
+
+        if (!dmt->dmi.v4 || !(dmt->dmi.v4->flags & DM_EXISTS_FLAG))
+		return 0;
+
+	if (*dmt->dmi.v4->name)
+		dev_name = dmt->dmi.v4->name;
+	else if (dmt->dev_name)
+		dev_name = dmt->dev_name;
+	else {
+		log_error("Get read ahead request failed: device name unrecorded.");
+		return 0;
+	}
+
+	return get_dev_node_read_ahead(dev_name, read_ahead);
 }
 
 const char *dm_task_get_name(const struct dm_task *dmt)

                 reply	other threads:[~2007-12-05 16:24 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=20071205162441.26547.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=dm-cvs@sourceware.org \
    --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.