• Alan Stern's avatar
    [PATCH] USB Storage: Remove non s-g pathway from subdriver READ/WRITE · 760c3b3a
    Alan Stern authored
    This patch does what you suggested.  The read/write routines from the
    updated subdrivers are changed so they don't bother to differentiate
    between transfers that do or do not use scatter-gather.  The low-level
    usb_stor_access_xfer_buf routine will Do The Right Thing regardless, and
    there probably won't ever be more than a few non s-g calls.  (What about
    filesystem I/O requests to access metadata?)
    
    It turns out that in addition to removing some comments and a few tests,
    this change allowed me to remove the buffer and use_sg arguments passed to
    the read/write routines as well.  So the simplification ended up being a
    bit bigger than I expected.
    
    While writing this patch, I noticed spots in several drivers that still
    need to be changed -- they slipped past me before.  These drivers handle
    things like READ-CAPACITY or REQUEST-SENSE by copying the data directly to
    srb->request_buffer, which is obviously wrong if s-g is being used.  I'll
    send in changes next week that convert them to use the
    usb_stor_set_xfer_buf function.  Like you said, it's going to be handy in
    more places than originally intended!
    760c3b3a
datafab.c 18.9 KB