Improve performance by optionally bypassing some code that uses bdget.

Signed-Off-By: Alasdair G Kergon <[EMAIL PROTECTED]>
--- diff/drivers/md/dm-ioctl.c  2005-01-12 20:50:16.000000000 +0000
+++ source/drivers/md/dm-ioctl.c        2005-01-12 20:50:07.000000000 +0000
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
- * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the GPL.
  */
@@ -520,19 +520,22 @@
        if (dm_suspended(md))
                param->flags |= DM_SUSPEND_FLAG;
 
-       bdev = bdget_disk(disk, 0);
-       if (!bdev)
-               return -ENXIO;
-
        param->dev = huge_encode_dev(MKDEV(disk->major, disk->first_minor));
 
-       /*
-        * Yes, this will be out of date by the time it gets back
-        * to userland, but it is still very useful ofr
-        * debugging.
-        */
-       param->open_count = bdev->bd_openers;
-       bdput(bdev);
+       if (!(param->flags & DM_SKIP_BDGET_FLAG)) {
+               bdev = bdget_disk(disk, 0);
+               if (!bdev)
+                       return -ENXIO;
+
+               /*
+                * Yes, this will be out of date by the time it gets back
+                * to userland, but it is still very useful for
+                * debugging.
+                */
+               param->open_count = bdev->bd_openers;
+               bdput(bdev);
+       } else
+               param->open_count = -1;
 
        if (disk->policy)
                param->flags |= DM_READONLY_FLAG;
--- diff/include/linux/dm-ioctl.h       2005-01-12 20:50:16.000000000 +0000
+++ source/include/linux/dm-ioctl.h     2005-01-12 20:49:42.000000000 +0000
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.
- * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the LGPL.
  */
@@ -272,9 +272,9 @@
 #define DM_TARGET_MSG   _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 
 #define DM_VERSION_MAJOR       4
-#define DM_VERSION_MINOR       3
+#define DM_VERSION_MINOR       4
 #define DM_VERSION_PATCHLEVEL  0
-#define DM_VERSION_EXTRA       "-ioctl (2004-09-30)"
+#define DM_VERSION_EXTRA       "-ioctl (2005-01-12)"
 
 /* Status bits */
 #define DM_READONLY_FLAG       (1 << 0) /* In/Out */
@@ -300,4 +300,9 @@
  */
 #define DM_BUFFER_FULL_FLAG    (1 << 8) /* Out */
 
+/*
+ * Set this to improve performance when you aren't going to use open_count
+ */
+#define DM_SKIP_BDGET_FLAG     (1 << 9) /* In */
+
 #endif                         /* _LINUX_DM_IOCTL_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to