Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146941
b: refs/heads/master
c: e686307
h: refs/heads/master
i:
  146939: e1165b8
v: v3
  • Loading branch information
Akinobu Mita authored and Jens Axboe committed Apr 28, 2009
1 parent a83ef75 commit e3c3ec9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 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: e93b9fb7d85da4fd9d5171649e5ddcac1dd572bf
refs/heads/master: e686307fdc84f249490e6c9da92fcb2424491f14
26 changes: 7 additions & 19 deletions trunk/drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,28 +511,15 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
*/
static void loop_add_bio(struct loop_device *lo, struct bio *bio)
{
if (lo->lo_biotail) {
lo->lo_biotail->bi_next = bio;
lo->lo_biotail = bio;
} else
lo->lo_bio = lo->lo_biotail = bio;
bio_list_add(&lo->lo_bio_list, bio);
}

/*
* Grab first pending buffer
*/
static struct bio *loop_get_bio(struct loop_device *lo)
{
struct bio *bio;

if ((bio = lo->lo_bio)) {
if (bio == lo->lo_biotail)
lo->lo_biotail = NULL;
lo->lo_bio = bio->bi_next;
bio->bi_next = NULL;
}

return bio;
return bio_list_pop(&lo->lo_bio_list);
}

static int loop_make_request(struct request_queue *q, struct bio *old_bio)
Expand Down Expand Up @@ -609,12 +596,13 @@ static int loop_thread(void *data)

set_user_nice(current, -20);

while (!kthread_should_stop() || lo->lo_bio) {
while (!kthread_should_stop() || !bio_list_empty(&lo->lo_bio_list)) {

wait_event_interruptible(lo->lo_event,
lo->lo_bio || kthread_should_stop());
!bio_list_empty(&lo->lo_bio_list) ||
kthread_should_stop());

if (!lo->lo_bio)
if (bio_list_empty(&lo->lo_bio_list))
continue;
spin_lock_irq(&lo->lo_lock);
bio = loop_get_bio(lo);
Expand Down Expand Up @@ -841,7 +829,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
lo->old_gfp_mask = mapping_gfp_mask(mapping);
mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));

lo->lo_bio = lo->lo_biotail = NULL;
bio_list_init(&lo->lo_bio_list);

/*
* set queue make_request_fn, and add limits based on lower level
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ static inline int bio_has_data(struct bio *bio)
}

/*
* BIO list managment for use by remapping drivers (e.g. DM or MD).
* BIO list management for use by remapping drivers (e.g. DM or MD) and loop.
*
* A bio_list anchors a singly-linked list of bios chained through the bi_next
* member of the bio. The bio_list also caches the last list member to allow
Expand Down
3 changes: 1 addition & 2 deletions trunk/include/linux/loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ struct loop_device {
gfp_t old_gfp_mask;

spinlock_t lo_lock;
struct bio *lo_bio;
struct bio *lo_biotail;
struct bio_list lo_bio_list;
int lo_state;
struct mutex lo_ctl_mutex;
struct task_struct *lo_thread;
Expand Down

0 comments on commit e3c3ec9

Please sign in to comment.