... they might actually succeed in some cases (when we are at the
queue-imposed segments limit, the next page is not mergable with
the last one we'd got in, but the first page covered by the next
iovec *is* mergable). Make sure that once it's failed, we are
done with that bio.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
if (n > bytes)
n = bytes;
- /*
- * sorry...
- */
- if (bio_add_pc_page(q, bio, pages[j], n, offs) < n)
+ if (!bio_add_pc_page(q, bio, pages[j], n, offs))
break;
/*
while (j < npages)
put_page(pages[j++]);
kvfree(pages);
+ /* couldn't stuff something into bio? */
+ if (bytes)
+ break;
}
bio_set_flag(bio, BIO_USER_MAPPED);