pbat_write tweaks
* Rename pblk_endio to pblk_write_endio. * Unlock pages last in pblk_write_endio. * Do page ops when prepare fails. * Ditch header guard.
This commit is contained in:
parent
7fbf77b1f3
commit
f1513f8cb3
|
@ -181,23 +181,23 @@ pblk_read(struct cbd_params* params,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pblk_endio(struct bio* bio)
|
pblk_write_endio(struct bio* bio)
|
||||||
{
|
{
|
||||||
u32 n;
|
u32 n;
|
||||||
struct page* page;
|
struct page* page;
|
||||||
|
|
||||||
BUG_ON(!bio);
|
BUG_ON(!bio);
|
||||||
for (n = 0; n < bio->bi_max_vecs; ++n) {
|
|
||||||
page = bio->bi_io_vec[n].bv_page;
|
|
||||||
unlock_page(page);
|
|
||||||
ClearPageDirty(page);
|
|
||||||
}
|
|
||||||
if (bio->bi_status != BLK_STS_OK) {
|
if (bio->bi_status != BLK_STS_OK) {
|
||||||
for (n = 0; n < bio->bi_max_vecs; ++n) {
|
for (n = 0; n < bio->bi_max_vecs; ++n) {
|
||||||
page = bio->bi_io_vec[n].bv_page;
|
page = bio->bi_io_vec[n].bv_page;
|
||||||
SetPageError(page);
|
SetPageError(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (n = 0; n < bio->bi_max_vecs; ++n) {
|
||||||
|
page = bio->bi_io_vec[n].bv_page;
|
||||||
|
ClearPageDirty(page);
|
||||||
|
unlock_page(page);
|
||||||
|
}
|
||||||
bio_put(bio);
|
bio_put(bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,21 +206,18 @@ pblk_write(struct cbd_params* params,
|
||||||
u64 pblk, u32 count, struct page** pagev)
|
u64 pblk, u32 count, struct page** pagev)
|
||||||
{
|
{
|
||||||
struct bio* bio;
|
struct bio* bio;
|
||||||
|
u32 n;
|
||||||
|
|
||||||
bio = pblk_io_prepare(params->priv, REQ_OP_WRITE, pblk, count, pagev);
|
bio = pblk_io_prepare(params->priv, REQ_OP_WRITE, pblk, count, pagev);
|
||||||
if (!bio) {
|
if (!bio) {
|
||||||
printk(KERN_ERR "%s: out of memory\n", __func__);
|
printk(KERN_ERR "%s: out of memory\n", __func__);
|
||||||
|
for (n = 0; n < count; ++n) {
|
||||||
|
SetPageError(pagev[n]);
|
||||||
|
unlock_page(pagev[n]);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bio->bi_end_io = pblk_endio;
|
bio->bi_end_io = pblk_write_endio;
|
||||||
|
|
||||||
if (pblk < CBD_HEADER_BLOCKS) {
|
|
||||||
printk(KERN_ERR "%s: *** Attempt to write header\n", __func__);
|
|
||||||
dump_stack();
|
|
||||||
bio->bi_status = BLK_STS_IOERR;
|
|
||||||
pblk_endio(bio);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
submit_bio(bio);
|
submit_bio(bio);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue