On Tue, 25 Jan 2011, Yauheni Kaliuta wrote: > Hi! > > file_storage.c has the following code in do_write(): > > nwritten = vfs_write(curlun->filp, > (char __user *) bh->buf, > amount, &file_offset_tmp); > VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, > (unsigned long long) file_offset, > (int) nwritten); > if (signal_pending(current)) > return -EINTR; // Interrupted! > > if (nwritten < 0) { > LDBG(curlun, "error in file write: %d\n", > (int) nwritten); > nwritten = 0; > } else if (nwritten < amount) { > LDBG(curlun, "partial file write: %d/%u\n", > (int) nwritten, amount); > nwritten -= (nwritten & 511); > // Round down to a block > } > file_offset += nwritten; > amount_left_to_write -= nwritten; > fsg->residue -= nwritten; > > /* If an error occurred, report it and its position */ > if (nwritten < amount) { > curlun->sense_data = SS_WRITE_ERROR; > curlun->sense_data_info = file_offset >> 9; > curlun->info_valid = 1; > break; > } > > In case of some data written (nwritten > 0), shouldn't it try to write > the rest before error reporting? In theory, perhaps it should. I haven't run across any situations where nwritten was > 0 and < amount. Likewise with reading. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html