diff options
| author | Mark Brown <[email protected]> | 2015-10-12 18:09:27 +0100 | 
|---|---|---|
| committer | Mark Brown <[email protected]> | 2015-10-12 18:09:27 +0100 | 
| commit | 79828b4fa835f73cdaf4bffa48696abdcbea9d02 (patch) | |
| tree | 5e0fa7156acb75ba603022bc807df8f2fedb97a8 /drivers/md/bcache/request.c | |
| parent | 721b51fcf91898299d96f4b72cb9434cda29dce6 (diff) | |
| parent | 8c1a9d6323abf0fb1e5dad96cf3f1c783505ea5a (diff) | |
Merge remote-tracking branch 'asoc/fix/rt5645' into asoc-fix-rt5645
Diffstat (limited to 'drivers/md/bcache/request.c')
| -rw-r--r-- | drivers/md/bcache/request.c | 57 | 
1 files changed, 33 insertions, 24 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 4afb2d26b148..8e9877b04637 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -88,8 +88,10 @@ static void bch_data_insert_keys(struct closure *cl)  	if (journal_ref)  		atomic_dec_bug(journal_ref); -	if (!op->insert_data_done) +	if (!op->insert_data_done) {  		continue_at(cl, bch_data_insert_start, op->wq); +		return; +	}  	bch_keylist_free(&op->insert_keys);  	closure_return(cl); @@ -171,22 +173,22 @@ static void bch_data_insert_error(struct closure *cl)  	bch_data_insert_keys(cl);  } -static void bch_data_insert_endio(struct bio *bio, int error) +static void bch_data_insert_endio(struct bio *bio)  {  	struct closure *cl = bio->bi_private;  	struct data_insert_op *op = container_of(cl, struct data_insert_op, cl); -	if (error) { +	if (bio->bi_error) {  		/* TODO: We could try to recover from this. */  		if (op->writeback) -			op->error = error; +			op->error = bio->bi_error;  		else if (!op->replace)  			set_closure_fn(cl, bch_data_insert_error, op->wq);  		else  			set_closure_fn(cl, NULL, NULL);  	} -	bch_bbio_endio(op->c, bio, error, "writing data to cache"); +	bch_bbio_endio(op->c, bio, bio->bi_error, "writing data to cache");  }  static void bch_data_insert_start(struct closure *cl) @@ -216,8 +218,10 @@ static void bch_data_insert_start(struct closure *cl)  		/* 1 for the device pointer and 1 for the chksum */  		if (bch_keylist_realloc(&op->insert_keys,  					3 + (op->csum ? 1 : 0), -					op->c)) +					op->c)) {  			continue_at(cl, bch_data_insert_keys, op->wq); +			return; +		}  		k = op->insert_keys.top;  		bkey_init(k); @@ -255,6 +259,7 @@ static void bch_data_insert_start(struct closure *cl)  	op->insert_data_done = true;  	continue_at(cl, bch_data_insert_keys, op->wq); +	return;  err:  	/* bch_alloc_sectors() blocks if s->writeback = true */  	BUG_ON(op->writeback); @@ -472,7 +477,7 @@ struct search {  	struct data_insert_op	iop;  }; -static void bch_cache_read_endio(struct bio *bio, int error) +static void bch_cache_read_endio(struct bio *bio)  {  	struct bbio *b = container_of(bio, struct bbio, bio);  	struct closure *cl = bio->bi_private; @@ -485,15 +490,15 @@ static void bch_cache_read_endio(struct bio *bio, int error)  	 * from the backing device.  	 */ -	if (error) -		s->iop.error = error; +	if (bio->bi_error) +		s->iop.error = bio->bi_error;  	else if (!KEY_DIRTY(&b->key) &&  		 ptr_stale(s->iop.c, &b->key, 0)) {  		atomic_long_inc(&s->iop.c->cache_read_races);  		s->iop.error = -EINTR;  	} -	bch_bbio_endio(s->iop.c, bio, error, "reading from cache"); +	bch_bbio_endio(s->iop.c, bio, bio->bi_error, "reading from cache");  }  /* @@ -576,21 +581,23 @@ static void cache_lookup(struct closure *cl)  	ret = bch_btree_map_keys(&s->op, s->iop.c,  				 &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0),  				 cache_lookup_fn, MAP_END_KEY); -	if (ret == -EAGAIN) +	if (ret == -EAGAIN) {  		continue_at(cl, cache_lookup, bcache_wq); +		return; +	}  	closure_return(cl);  }  /* Common code for the make_request functions */ -static void request_endio(struct bio *bio, int error) +static void request_endio(struct bio *bio)  {  	struct closure *cl = bio->bi_private; -	if (error) { +	if (bio->bi_error) {  		struct search *s = container_of(cl, struct search, cl); -		s->iop.error = error; +		s->iop.error = bio->bi_error;  		/* Only cache read errors are recoverable */  		s->recoverable = false;  	} @@ -606,7 +613,8 @@ static void bio_complete(struct search *s)  				    &s->d->disk->part0, s->start_time);  		trace_bcache_request_end(s->d, s->orig_bio); -		bio_endio(s->orig_bio, s->iop.error); +		s->orig_bio->bi_error = s->iop.error; +		bio_endio(s->orig_bio);  		s->orig_bio = NULL;  	}  } @@ -711,7 +719,7 @@ static void cached_dev_read_error(struct closure *cl)  		/* XXX: invalidate cache */ -		closure_bio_submit(bio, cl, s->d); +		closure_bio_submit(bio, cl);  	}  	continue_at(cl, cached_dev_cache_miss_done, NULL); @@ -834,7 +842,7 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s,  	s->cache_miss	= miss;  	s->iop.bio	= cache_bio;  	bio_get(cache_bio); -	closure_bio_submit(cache_bio, &s->cl, s->d); +	closure_bio_submit(cache_bio, &s->cl);  	return ret;  out_put: @@ -842,7 +850,7 @@ out_put:  out_submit:  	miss->bi_end_io		= request_endio;  	miss->bi_private	= &s->cl; -	closure_bio_submit(miss, &s->cl, s->d); +	closure_bio_submit(miss, &s->cl);  	return ret;  } @@ -907,7 +915,7 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s)  		if (!(bio->bi_rw & REQ_DISCARD) ||  		    blk_queue_discard(bdev_get_queue(dc->bdev))) -			closure_bio_submit(bio, cl, s->d); +			closure_bio_submit(bio, cl);  	} else if (s->iop.writeback) {  		bch_writeback_add(dc);  		s->iop.bio = bio; @@ -922,12 +930,12 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s)  			flush->bi_end_io = request_endio;  			flush->bi_private = cl; -			closure_bio_submit(flush, cl, s->d); +			closure_bio_submit(flush, cl);  		}  	} else {  		s->iop.bio = bio_clone_fast(bio, GFP_NOIO, dc->disk.bio_split); -		closure_bio_submit(bio, cl, s->d); +		closure_bio_submit(bio, cl);  	}  	closure_call(&s->iop.cl, bch_data_insert, NULL, cl); @@ -943,7 +951,7 @@ static void cached_dev_nodata(struct closure *cl)  		bch_journal_meta(s->iop.c, cl);  	/* If it's a flush, we send the flush to the backing device too */ -	closure_bio_submit(bio, cl, s->d); +	closure_bio_submit(bio, cl);  	continue_at(cl, cached_dev_bio_complete, NULL);  } @@ -985,9 +993,9 @@ static void cached_dev_make_request(struct request_queue *q, struct bio *bio)  	} else {  		if ((bio->bi_rw & REQ_DISCARD) &&  		    !blk_queue_discard(bdev_get_queue(dc->bdev))) -			bio_endio(bio, 0); +			bio_endio(bio);  		else -			bch_generic_make_request(bio, &d->bio_split_hook); +			generic_make_request(bio);  	}  } @@ -1085,6 +1093,7 @@ static void flash_dev_make_request(struct request_queue *q, struct bio *bio)  		continue_at_nobarrier(&s->cl,  				      flash_dev_nodata,  				      bcache_wq); +		return;  	} else if (rw) {  		bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys,  					&KEY(d->id, bio->bi_iter.bi_sector, 0),  |