Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 40482
b: refs/heads/master
c: be609f3
h: refs/heads/master
v: v3
  • Loading branch information
Ralf Baechle committed Oct 30, 2006
1 parent d97c31b commit 29c3207
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 42 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: df6c0cd9a872ebf2298f5d66d8c789f62dbe35fc
refs/heads/master: be609f3546d3dd96afd7df8856a91fa2b8825fbc
10 changes: 6 additions & 4 deletions trunk/arch/mips/oprofile/op_model_mipsxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@
#define M_COUNTER_OVERFLOW (1UL << 31)

#ifdef CONFIG_MIPS_MT_SMP
#define WHAT (M_TC_EN_VPE | M_PERFCTL_VPEID(smp_processor_id()))
#define WHAT (M_TC_EN_VPE | M_PERFCTL_VPEID(smp_processor_id()))
#define vpe_id() smp_processor_id()
#else
#define WHAT 0
#define WHAT 0
#define vpe_id() smp_processor_id()
#endif

#define __define_perf_accessors(r, n, np) \
\
static inline unsigned int r_c0_ ## r ## n(void) \
{ \
unsigned int cpu = smp_processor_id(); \
unsigned int cpu = vpe_id(); \
\
switch (cpu) { \
case 0: \
Expand All @@ -55,7 +57,7 @@ static inline unsigned int r_c0_ ## r ## n(void) \
\
static inline void w_c0_ ## r ## n(unsigned int value) \
{ \
unsigned int cpu = smp_processor_id(); \
unsigned int cpu = vpe_id(); \
\
switch (cpu) { \
case 0: \
Expand Down
54 changes: 17 additions & 37 deletions trunk/fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,39 +641,17 @@ static void free_bd_holder(struct bd_holder *bo)
kfree(bo);
}

/**
* find_bd_holder - find matching struct bd_holder from the block device
*
* @bdev: struct block device to be searched
* @bo: target struct bd_holder
*
* Returns matching entry with @bo in @bdev->bd_holder_list.
* If found, increment the reference count and return the pointer.
* If not found, returns NULL.
*/
static int find_bd_holder(struct block_device *bdev, struct bd_holder *bo)
{
struct bd_holder *tmp;

list_for_each_entry(tmp, &bdev->bd_holder_list, list)
if (tmp->sdir == bo->sdir) {
tmp->count++;
return tmp;
}

return NULL;
}

/**
* add_bd_holder - create sysfs symlinks for bd_claim() relationship
*
* @bdev: block device to be bd_claimed
* @bo: preallocated and initialized by alloc_bd_holder()
*
* Add @bo to @bdev->bd_holder_list, create symlinks.
* If there is no matching entry with @bo in @bdev->bd_holder_list,
* add @bo to the list, create symlinks.
*
* Returns 0 if symlinks are created.
* Returns -ve if something fails.
* Returns 0 if symlinks are created or already there.
* Returns -ve if something fails and @bo can be freed.
*/
static int add_bd_holder(struct block_device *bdev, struct bd_holder *bo)
{
Expand All @@ -683,6 +661,15 @@ static int add_bd_holder(struct block_device *bdev, struct bd_holder *bo)
if (!bo)
return -EINVAL;

list_for_each_entry(tmp, &bdev->bd_holder_list, list) {
if (tmp->sdir == bo->sdir) {
tmp->count++;
/* We've already done what we need to do here. */
free_bd_holder(bo);
return 0;
}
}

if (!bd_holder_grab_dirs(bdev, bo))
return -EBUSY;

Expand Down Expand Up @@ -753,7 +740,7 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
struct kobject *kobj)
{
int res;
struct bd_holder *bo, *found;
struct bd_holder *bo;

if (!kobj)
return -EINVAL;
Expand All @@ -764,16 +751,9 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,

mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION);
res = bd_claim(bdev, holder);
if (res == 0) {
found = find_bd_holder(bdev, bo);
if (found == NULL) {
res = add_bd_holder(bdev, bo);
if (res)
bd_release(bdev);
}
}

if (res || found)
if (res == 0)
res = add_bd_holder(bdev, bo);
if (res)
free_bd_holder(bo);
mutex_unlock(&bdev->bd_mutex);

Expand Down

0 comments on commit 29c3207

Please sign in to comment.