We're allowed to start at a non-aligned page offset in the first
fragment and end at a non-aligned page offset in the last fragment.
When checking the iovec exclude both of the first and last fragments
from the tx_gaps check.
Test-Parameters: trivial
Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Change-Id: I8a9231db7db404a5d5a6294ff263c1bd2ac28e6c
Reviewed-on: https://review.whamcloud.com/32586
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Doug Oucharek <dougso@me.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
unsigned long vaddr;
int fragnob;
int page_offset;
unsigned long vaddr;
int fragnob;
int page_offset;
LASSERT (nob > 0);
LASSERT (niov > 0);
LASSERT (nob > 0);
LASSERT (niov > 0);
sg = tx->tx_frags;
do {
LASSERT(niov > 0);
sg = tx->tx_frags;
do {
LASSERT(niov > 0);
fragnob = min((int)(iov->iov_len - offset), nob);
fragnob = min(fragnob, (int)PAGE_SIZE - page_offset);
fragnob = min((int)(iov->iov_len - offset), nob);
fragnob = min(fragnob, (int)PAGE_SIZE - page_offset);
- if ((fragnob < (int)PAGE_SIZE - page_offset) && (niov > 1)) {
+ /*
+ * We're allowed to start at a non-aligned page offset in
+ * the first fragment and end at a non-aligned page offset
+ * in the last fragment.
+ */
+ if ((fragnob < (int)PAGE_SIZE - page_offset) &&
+ (niov < max_niov) && nob > fragnob) {
CDEBUG(D_NET, "fragnob %d < available page %d: with"
CDEBUG(D_NET, "fragnob %d < available page %d: with"
- " remaining %d iovs\n",
- fragnob, (int)PAGE_SIZE - page_offset, niov);
+ " remaining %d iovs with %d nob left\n",
+ fragnob, (int)PAGE_SIZE - page_offset, niov,
+ nob);
kib_net_t *net = ni->ni_data;
struct scatterlist *sg;
int fragnob;
kib_net_t *net = ni->ni_data;
struct scatterlist *sg;
int fragnob;
CDEBUG(D_NET, "niov %d offset %d nob %d\n", nkiov, offset, nob);
CDEBUG(D_NET, "niov %d offset %d nob %d\n", nkiov, offset, nob);
sg = tx->tx_frags;
do {
LASSERT(nkiov > 0);
fragnob = min((int)(kiov->kiov_len - offset), nob);
sg = tx->tx_frags;
do {
LASSERT(nkiov > 0);
fragnob = min((int)(kiov->kiov_len - offset), nob);
- if ((fragnob < (int)(kiov->kiov_len - offset)) && nkiov > 1) {
+ /*
+ * We're allowed to start at a non-aligned page offset in
+ * the first fragment and end at a non-aligned page offset
+ * in the last fragment.
+ */
+ if ((fragnob < (int)(kiov->kiov_len - offset)) &&
+ nkiov < max_nkiov && nob > fragnob) {
CDEBUG(D_NET, "fragnob %d < available page %d: with"
CDEBUG(D_NET, "fragnob %d < available page %d: with"
- " remaining %d kiovs\n",
- fragnob, (int)(kiov->kiov_len - offset), nkiov);
+ " remaining %d kiovs with %d nob left\n",
+ fragnob, (int)(kiov->kiov_len - offset),
+ nkiov, nob);