+ dm-consolidate-creation-functions.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     dm: consolidate creation functions

has been added to the -mm tree.  Its filename is

     dm-consolidate-creation-functions.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: dm: consolidate creation functions
From: Alasdair G Kergon <agk@xxxxxxxxxx>


Merge dm_create() and dm_create_with_minor() by introducing the special value
DM_ANY_MINOR to request the allocation of the next available minor number.

Signed-off-by: Alasdair G Kergon <agk@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/md/dm-ioctl.c |    9 ++++-----
 drivers/md/dm.c       |   35 +++++++++++++----------------------
 drivers/md/dm.h       |   13 +++++++++----
 3 files changed, 26 insertions(+), 31 deletions(-)

diff -puN drivers/md/dm.c~dm-consolidate-creation-functions drivers/md/dm.c
--- a/drivers/md/dm.c~dm-consolidate-creation-functions
+++ a/drivers/md/dm.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
- * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the GPL.
  */
@@ -804,7 +804,7 @@ static int dm_any_congested(void *conges
  *---------------------------------------------------------------*/
 static DEFINE_IDR(_minor_idr);
 
-static void free_minor(unsigned int minor)
+static void free_minor(int minor)
 {
 	spin_lock(&_minor_lock);
 	idr_remove(&_minor_idr, minor);
@@ -814,7 +814,7 @@ static void free_minor(unsigned int mino
 /*
  * See if the device with a specific minor # is free.
  */
-static int specific_minor(struct mapped_device *md, unsigned int minor)
+static int specific_minor(struct mapped_device *md, int minor)
 {
 	int r, m;
 
@@ -847,10 +847,9 @@ out:
 	return r;
 }
 
-static int next_free_minor(struct mapped_device *md, unsigned int *minor)
+static int next_free_minor(struct mapped_device *md, int *minor)
 {
-	int r;
-	unsigned int m;
+	int r, m;
 
 	r = idr_pre_get(&_minor_idr, GFP_KERNEL);
 	if (!r)
@@ -881,7 +880,7 @@ static struct block_device_operations dm
 /*
  * Allocate and initialise a blank device with a given minor.
  */
-static struct mapped_device *alloc_dev(unsigned int minor, int persistent)
+static struct mapped_device *alloc_dev(int minor)
 {
 	int r;
 	struct mapped_device *md = kmalloc(sizeof(*md), GFP_KERNEL);
@@ -896,7 +895,10 @@ static struct mapped_device *alloc_dev(u
 		goto bad0;
 
 	/* get a minor number for the dev */
-	r = persistent ? specific_minor(md, minor) : next_free_minor(md, &minor);
+	if (minor == DM_ANY_MINOR)
+		r = next_free_minor(md, &minor);
+	else
+		r = specific_minor(md, minor);
 	if (r < 0)
 		goto bad1;
 
@@ -969,7 +971,7 @@ static struct mapped_device *alloc_dev(u
 
 static void free_dev(struct mapped_device *md)
 {
-	unsigned int minor = md->disk->first_minor;
+	int minor = md->disk->first_minor;
 
 	if (md->suspended_bdev) {
 		thaw_bdev(md->suspended_bdev, NULL);
@@ -1055,12 +1057,11 @@ static void __unbind(struct mapped_devic
 /*
  * Constructor for a new device.
  */
-static int create_aux(unsigned int minor, int persistent,
-		      struct mapped_device **result)
+int dm_create(int minor, struct mapped_device **result)
 {
 	struct mapped_device *md;
 
-	md = alloc_dev(minor, persistent);
+	md = alloc_dev(minor);
 	if (!md)
 		return -ENXIO;
 
@@ -1068,16 +1069,6 @@ static int create_aux(unsigned int minor
 	return 0;
 }
 
-int dm_create(struct mapped_device **result)
-{
-	return create_aux(0, 0, result);
-}
-
-int dm_create_with_minor(unsigned int minor, struct mapped_device **result)
-{
-	return create_aux(minor, 1, result);
-}
-
 static struct mapped_device *dm_find_md(dev_t dev)
 {
 	struct mapped_device *md;
diff -puN drivers/md/dm.h~dm-consolidate-creation-functions drivers/md/dm.h
--- a/drivers/md/dm.h~dm-consolidate-creation-functions
+++ a/drivers/md/dm.h
@@ -2,7 +2,7 @@
  * Internal header file for device mapper
  *
  * Copyright (C) 2001, 2002 Sistina Software
- * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the LGPL.
  */
@@ -45,16 +45,21 @@ struct mapped_device;
  * Functions for manipulating a struct mapped_device.
  * Drop the reference with dm_put when you finish with the object.
  *---------------------------------------------------------------*/
-int dm_create(struct mapped_device **md);
-int dm_create_with_minor(unsigned int minor, struct mapped_device **md);
+
+/*
+ * DM_ANY_MINOR allocates any available minor number.
+ */
+#define DM_ANY_MINOR (-1)
+int dm_create(int minor, struct mapped_device **md);
+
 void dm_set_mdptr(struct mapped_device *md, void *ptr);
 void *dm_get_mdptr(struct mapped_device *md);
-struct mapped_device *dm_get_md(dev_t dev);
 
 /*
  * Reference counting for md.
  */
 void dm_get(struct mapped_device *md);
+struct mapped_device *dm_get_md(dev_t dev);
 void dm_put(struct mapped_device *md);
 
 /*
diff -puN drivers/md/dm-ioctl.c~dm-consolidate-creation-functions drivers/md/dm-ioctl.c
--- a/drivers/md/dm-ioctl.c~dm-consolidate-creation-functions
+++ a/drivers/md/dm-ioctl.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
- * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004 - 2006 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the GPL.
  */
@@ -578,7 +578,7 @@ static int __dev_status(struct mapped_de
 
 static int dev_create(struct dm_ioctl *param, size_t param_size)
 {
-	int r;
+	int r, m = DM_ANY_MINOR;
 	struct mapped_device *md;
 
 	r = check_name(param->name);
@@ -586,10 +586,9 @@ static int dev_create(struct dm_ioctl *p
 		return r;
 
 	if (param->flags & DM_PERSISTENT_DEV_FLAG)
-		r = dm_create_with_minor(MINOR(huge_decode_dev(param->dev)), &md);
-	else
-		r = dm_create(&md);
+		m = MINOR(huge_decode_dev(param->dev));
 
+	r = dm_create(m, &md);
 	if (r)
 		return r;
 
_

Patches currently in -mm which might be from agk@xxxxxxxxxx are

git-hdrinstall2.patch
dm-snapshot-unify-chunk_size.patch
lib-add-idr_replace.patch
lib-add-idr_replace-tidy.patch
dm-fix-idr-minor-allocation.patch
dm-move-idr_pre_get.patch
dm-change-minor_lock-to-spinlock.patch
dm-add-dmf_freeing.patch
dm-fix-mapped-device-ref-counting.patch
dm-add-module-ref-counting.patch
dm-fix-block-device-initialisation.patch
dm-mirror-sector-offset-fix.patch
dm-table-get_target-fix-last-index.patch
dm-support-ioctls-on-mapped-devices.patch
dm-linear-support-ioctls.patch
dm-mpath-support-ioctls.patch
dm-export-blkdev_driver_ioctl.patch
dm-mirror-log-sector-size-fix.patch
dm-mirror-log-refactor-context.patch
dm-mirror-log-bitset_size-fix.patch
dm-mirror-log-sync_count-fix.patch
dm-kcopyd-error-accumulation-fix.patch
dm-table-split_args-handle-no-input.patch
dm-consolidate-creation-functions.patch
dm-add-exports.patch
dm-create-error-table.patch
dm-prevent-removal-if-open.patch
dm-improve-error-message-consistency.patch
md-dm-reduce-stack-usage-with-stacked-block-devices.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux