Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242298
b: refs/heads/master
c: 1e9bb88
h: refs/heads/master
v: v3
  • Loading branch information
Shaohua Li authored and Jens Axboe committed Mar 22, 2011
1 parent 8714ed2 commit 4721358
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 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: 5e84ea3a9c662dc2d7a48703a4468fad954a3b7f
refs/heads/master: 1e9bb8808ac11094d711d20d580e7b45a4992d0c
7 changes: 4 additions & 3 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ static void start_io_acct(struct dm_io *io)
cpu = part_stat_lock();
part_round_stats(cpu, &dm_disk(md)->part0);
part_stat_unlock();
dm_disk(md)->part0.in_flight[rw] = atomic_inc_return(&md->pending[rw]);
atomic_set(&dm_disk(md)->part0.in_flight[rw],
atomic_inc_return(&md->pending[rw]));
}

static void end_io_acct(struct dm_io *io)
Expand All @@ -497,8 +498,8 @@ static void end_io_acct(struct dm_io *io)
* After this is decremented the bio must not be touched if it is
* a flush.
*/
dm_disk(md)->part0.in_flight[rw] = pending =
atomic_dec_return(&md->pending[rw]);
pending = atomic_dec_return(&md->pending[rw]);
atomic_set(&dm_disk(md)->part0.in_flight[rw], pending);
pending += atomic_read(&md->pending[rw^0x1]);

/* nudge anyone waiting on suspend queue */
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/partitions/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ ssize_t part_inflight_show(struct device *dev,
{
struct hd_struct *p = dev_to_part(dev);

return sprintf(buf, "%8u %8u\n", p->in_flight[0], p->in_flight[1]);
return sprintf(buf, "%8u %8u\n", atomic_read(&p->in_flight[0]),
atomic_read(&p->in_flight[1]));
}

#ifdef CONFIG_FAIL_MAKE_REQUEST
Expand Down
12 changes: 6 additions & 6 deletions trunk/include/linux/genhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ struct hd_struct {
int make_it_fail;
#endif
unsigned long stamp;
int in_flight[2];
atomic_t in_flight[2];
#ifdef CONFIG_SMP
struct disk_stats __percpu *dkstats;
#else
Expand Down Expand Up @@ -370,21 +370,21 @@ static inline void free_part_stats(struct hd_struct *part)

static inline void part_inc_in_flight(struct hd_struct *part, int rw)
{
part->in_flight[rw]++;
atomic_inc(&part->in_flight[rw]);
if (part->partno)
part_to_disk(part)->part0.in_flight[rw]++;
atomic_inc(&part_to_disk(part)->part0.in_flight[rw]);
}

static inline void part_dec_in_flight(struct hd_struct *part, int rw)
{
part->in_flight[rw]--;
atomic_dec(&part->in_flight[rw]);
if (part->partno)
part_to_disk(part)->part0.in_flight[rw]--;
atomic_dec(&part_to_disk(part)->part0.in_flight[rw]);
}

static inline int part_in_flight(struct hd_struct *part)
{
return part->in_flight[0] + part->in_flight[1];
return atomic_read(&part->in_flight[0]) + atomic_read(&part->in_flight[1]);
}

static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk)
Expand Down

0 comments on commit 4721358

Please sign in to comment.