Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24423
b: refs/heads/master
c: 48c9c27
h: refs/heads/master
i:
  24421: 2fd427b
  24419: a411478
  24415: fafdff7
v: v3
  • Loading branch information
Arjan van de Ven authored and Linus Torvalds committed Mar 27, 2006
1 parent f8ba3ec commit 2dbba4d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2f889129de148b0ba2e1fbc9e9d33a4ef4c5f2cb
refs/heads/master: 48c9c27b8bcd2a328a06151e2d5c1170db0b701b
11 changes: 6 additions & 5 deletions trunk/drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/ctype.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <asm/atomic.h>

#define MAX_DEPTH 16
Expand Down Expand Up @@ -770,14 +771,14 @@ int dm_table_complete(struct dm_table *t)
return r;
}

static DECLARE_MUTEX(_event_lock);
static DEFINE_MUTEX(_event_lock);
void dm_table_event_callback(struct dm_table *t,
void (*fn)(void *), void *context)
{
down(&_event_lock);
mutex_lock(&_event_lock);
t->event_fn = fn;
t->event_context = context;
up(&_event_lock);
mutex_unlock(&_event_lock);
}

void dm_table_event(struct dm_table *t)
Expand All @@ -788,10 +789,10 @@ void dm_table_event(struct dm_table *t)
*/
BUG_ON(in_interrupt());

down(&_event_lock);
mutex_lock(&_event_lock);
if (t->event_fn)
t->event_fn(t->event_context);
up(&_event_lock);
mutex_unlock(&_event_lock);
}

sector_t dm_table_get_size(struct dm_table *t)
Expand Down
19 changes: 10 additions & 9 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <linux/init.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/moduleparam.h>
#include <linux/blkpg.h>
#include <linux/bio.h>
Expand Down Expand Up @@ -743,14 +744,14 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
/*-----------------------------------------------------------------
* An IDR is used to keep track of allocated minor numbers.
*---------------------------------------------------------------*/
static DECLARE_MUTEX(_minor_lock);
static DEFINE_MUTEX(_minor_lock);
static DEFINE_IDR(_minor_idr);

static void free_minor(unsigned int minor)
{
down(&_minor_lock);
mutex_lock(&_minor_lock);
idr_remove(&_minor_idr, minor);
up(&_minor_lock);
mutex_unlock(&_minor_lock);
}

/*
Expand All @@ -763,7 +764,7 @@ static int specific_minor(struct mapped_device *md, unsigned int minor)
if (minor >= (1 << MINORBITS))
return -EINVAL;

down(&_minor_lock);
mutex_lock(&_minor_lock);

if (idr_find(&_minor_idr, minor)) {
r = -EBUSY;
Expand All @@ -788,7 +789,7 @@ static int specific_minor(struct mapped_device *md, unsigned int minor)
}

out:
up(&_minor_lock);
mutex_unlock(&_minor_lock);
return r;
}

Expand All @@ -797,7 +798,7 @@ static int next_free_minor(struct mapped_device *md, unsigned int *minor)
int r;
unsigned int m;

down(&_minor_lock);
mutex_lock(&_minor_lock);

r = idr_pre_get(&_minor_idr, GFP_KERNEL);
if (!r) {
Expand All @@ -819,7 +820,7 @@ static int next_free_minor(struct mapped_device *md, unsigned int *minor)
*minor = m;

out:
up(&_minor_lock);
mutex_unlock(&_minor_lock);
return r;
}

Expand Down Expand Up @@ -1014,13 +1015,13 @@ static struct mapped_device *dm_find_md(dev_t dev)
if (MAJOR(dev) != _major || minor >= (1 << MINORBITS))
return NULL;

down(&_minor_lock);
mutex_lock(&_minor_lock);

md = idr_find(&_minor_idr, minor);
if (!md || (dm_disk(md)->first_minor != minor))
md = NULL;

up(&_minor_lock);
mutex_unlock(&_minor_lock);

return md;
}
Expand Down
11 changes: 6 additions & 5 deletions trunk/drivers/md/kcopyd.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>

#include "kcopyd.h"

Expand Down Expand Up @@ -581,21 +582,21 @@ int kcopyd_cancel(struct kcopyd_job *job, int block)
/*-----------------------------------------------------------------
* Unit setup
*---------------------------------------------------------------*/
static DECLARE_MUTEX(_client_lock);
static DEFINE_MUTEX(_client_lock);
static LIST_HEAD(_clients);

static void client_add(struct kcopyd_client *kc)
{
down(&_client_lock);
mutex_lock(&_client_lock);
list_add(&kc->list, &_clients);
up(&_client_lock);
mutex_unlock(&_client_lock);
}

static void client_del(struct kcopyd_client *kc)
{
down(&_client_lock);
mutex_lock(&_client_lock);
list_del(&kc->list);
up(&_client_lock);
mutex_unlock(&_client_lock);
}

static DEFINE_MUTEX(kcopyd_init_lock);
Expand Down
11 changes: 6 additions & 5 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <linux/buffer_head.h> /* for invalidate_bdev */
#include <linux/suspend.h>
#include <linux/poll.h>
#include <linux/mutex.h>

#include <linux/init.h>

Expand Down Expand Up @@ -2500,7 +2501,7 @@ int mdp_major = 0;

static struct kobject *md_probe(dev_t dev, int *part, void *data)
{
static DECLARE_MUTEX(disks_sem);
static DEFINE_MUTEX(disks_mutex);
mddev_t *mddev = mddev_find(dev);
struct gendisk *disk;
int partitioned = (MAJOR(dev) != MD_MAJOR);
Expand All @@ -2510,15 +2511,15 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
if (!mddev)
return NULL;

down(&disks_sem);
mutex_lock(&disks_mutex);
if (mddev->gendisk) {
up(&disks_sem);
mutex_unlock(&disks_mutex);
mddev_put(mddev);
return NULL;
}
disk = alloc_disk(1 << shift);
if (!disk) {
up(&disks_sem);
mutex_unlock(&disks_mutex);
mddev_put(mddev);
return NULL;
}
Expand All @@ -2536,7 +2537,7 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
disk->queue = mddev->queue;
add_disk(disk);
mddev->gendisk = disk;
up(&disks_sem);
mutex_unlock(&disks_mutex);
mddev->kobj.parent = &disk->kobj;
mddev->kobj.k_name = NULL;
snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");
Expand Down

0 comments on commit 2dbba4d

Please sign in to comment.