mass storage error reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?
--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux