07 Nov, 2015

1 commit

  • __GFP_WAIT was used to signal that the caller was in atomic context and
    could not sleep. Now it is possible to distinguish between true atomic
    context and callers that are not willing to sleep. The latter should
    clear __GFP_DIRECT_RECLAIM so kswapd will still wake. As clearing
    __GFP_WAIT behaves differently, there is a risk that people will clear the
    wrong flags. This patch renames __GFP_WAIT to __GFP_RECLAIM to clearly
    indicate what it does -- setting it allows all reclaim activity, clearing
    them prevents it.

    [akpm@linux-foundation.org: fix build]
    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Mel Gorman
    Acked-by: Michal Hocko
    Acked-by: Vlastimil Babka
    Acked-by: Johannes Weiner
    Cc: Christoph Lameter
    Acked-by: David Rientjes
    Cc: Vitaly Wool
    Cc: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     

06 May, 2015

2 commits


01 Nov, 2011

1 commit


10 Mar, 2011

1 commit

  • Code has been converted over to the new explicit on-stack plugging,
    and delay users have been converted to use the new API for that.
    So lets kill off the old plugging along with aops->sync_page().

    Signed-off-by: Jens Axboe

    Jens Axboe
     

08 Aug, 2010

2 commits


08 Apr, 2010

1 commit


01 Apr, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

21 Jun, 2009

1 commit

  • * 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (34 commits)
    ide-cd: prevent null pointer deref via cdrom_newpc_intr
    ide: BUG() on unknown requests
    ide: filter out invalid DMA xfer mode changes in HDIO_DRIVE_CMD ioctl handler
    ide: do not access ide_drive_t 'drive_data' field directly
    sl82c105: implement test_irq() method
    siimage: implement test_irq() method
    pdc202xx_old: implement test_irq() method (take 2)
    cmd64x: implement test_irq() method
    cmd640: implement test_irq() method
    ide: move ack_intr() method into 'struct ide_port_ops' (take 2)
    ide: move IRQ clearing from ack_intr() method to clear_irq() method (take 2)
    siimage: use ide_dma_test_irq() (take 2)
    cmd64x: implement clear_irq() method (take 2)
    ide: call clear_irq() method in ide_timer_expiry()
    sgiioc4: coding style cleanup
    ide: don't enable IORDY at a probe time
    ide: IORDY handling fixes
    ata: add ata_id_pio_need_iordy() helper (v2)
    ide-tape: fix build issue
    ide: unify interrupt reason checking
    ...

    Linus Torvalds
     

15 Jun, 2009

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (31 commits)
    trivial: remove the trivial patch monkey's name from SubmittingPatches
    trivial: Fix a typo in comment of addrconf_dad_start()
    trivial: usb: fix missing space typo in doc
    trivial: pci hotplug: adding __init/__exit macros to sgi_hotplug
    trivial: Remove the hyphen from git commands
    trivial: fix ETIMEOUT -> ETIMEDOUT typos
    trivial: Kconfig: .ko is normally not included in module names
    trivial: SubmittingPatches: fix typo
    trivial: Documentation/dell_rbu.txt: fix typos
    trivial: Fix Pavel's address in MAINTAINERS
    trivial: ftrace:fix description of trace directory
    trivial: unnecessary (void*) cast removal in sound/oss/msnd.c
    trivial: input/misc: Fix typo in Kconfig
    trivial: fix grammo in bus_for_each_dev() kerneldoc
    trivial: rbtree.txt: fix rb_entry() parameters in sample code
    trivial: spelling fix in ppc code comments
    trivial: fix typo in bio_alloc kernel doc
    trivial: Documentation/rbtree.txt: cleanup kerneldoc of rbtree.txt
    trivial: Miscellaneous documentation typo fixes
    trivial: fix typo milisecond/millisecond for documentation and source comments.
    ...

    Linus Torvalds
     

13 Jun, 2009

3 commits

  • Conflicts:
    drivers/ide/ide-tape.c

    Bartlomiej Zolnierkiewicz
     
  • * 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (29 commits)
    ide: re-implement ide_pci_init_one() on top of ide_pci_init_two()
    ide: unexport ide_find_dma_mode()
    ide: fix PowerMac bootup oops
    ide: skip probe if there are no devices on the port (v2)
    sl82c105: add printk() logging facility
    ide-tape: fix proc warning
    ide: add IDE_DFLAG_NIEN_QUIRK device flag
    ide: respect quirk_drives[] list on all controllers
    hpt366: enable all quirks for devices on quirk_drives[] list
    hpt366: sync quirk_drives[] list with pdc202xx_{new,old}.c
    ide: remove superfluous SELECT_MASK() call from do_rw_taskfile()
    ide: remove superfluous SELECT_MASK() call from ide_driveid_update()
    icside: remove superfluous ->maskproc method
    ide-tape: fix IDE_AFLAG_* atomic accesses
    ide-tape: change IDE_AFLAG_IGNORE_DSC non-atomically
    pdc202xx_old: kill resetproc() method
    pdc202xx_old: don't call pdc202xx_reset() on IRQ timeout
    pdc202xx_old: use ide_dma_test_irq()
    ide: preserve Host Protected Area by default (v2)
    ide-gd: implement block device ->set_capacity method (v2)
    ...

    Linus Torvalds
     
  • Signed-off-by: Martin Olsson
    Signed-off-by: Jiri Kosina

    Martin Olsson
     

12 Jun, 2009

1 commit

  • * 'for-2.6.31' of git://git.kernel.dk/linux-2.6-block: (153 commits)
    block: add request clone interface (v2)
    floppy: fix hibernation
    ramdisk: remove long-deprecated "ramdisk=" boot-time parameter
    fs/bio.c: add missing __user annotation
    block: prevent possible io_context->refcount overflow
    Add serial number support for virtio_blk, V4a
    block: Add missing bounce_pfn stacking and fix comments
    Revert "block: Fix bounce limit setting in DM"
    cciss: decode unit attention in SCSI error handling code
    cciss: Remove no longer needed sendcmd reject processing code
    cciss: change SCSI error handling routines to work with interrupts enabled.
    cciss: separate error processing and command retrying code in sendcmd_withirq_core()
    cciss: factor out fix target status processing code from sendcmd functions
    cciss: simplify interface of sendcmd() and sendcmd_withirq()
    cciss: factor out core of sendcmd_withirq() for use by SCSI error handling code
    cciss: Use schedule_timeout_uninterruptible in SCSI error handling code
    block: needs to set the residual length of a bidi request
    Revert "block: implement blkdev_readpages"
    block: Fix bounce limit setting in DM
    Removed reference to non-existing file Documentation/PCI/PCI-DMA-mapping.txt
    ...

    Manually fix conflicts with tracing updates in:
    block/blk-sysfs.c
    drivers/ide/ide-atapi.c
    drivers/ide/ide-cd.c
    drivers/ide/ide-floppy.c
    drivers/ide/ide-tape.c
    include/trace/events/block.h
    kernel/trace/blktrace.c

    Linus Torvalds
     

07 Jun, 2009

1 commit


15 May, 2009

7 commits

  • Add ide_check_ireason() function that handles all ATAPI devices.
    Reorganize all unlikely cases in ireason checking further down in the
    code path.

    In addition, add PFX for printks originating from ide-atapi. Finally,
    remove ide_cd_check_ireason.

    Signed-off-by: Borislav Petkov

    Borislav Petkov
     
  • Now after all users of pc->buf have been converted, remove the 64B buffer
    embedded in each packet command.

    There should be no functional change resulting from this patch.

    Signed-off-by: Borislav Petkov

    Borislav Petkov
     
  • Access the sense buffer through the bio in ->pc_callback method thus
    alleviating the need for the pc->buf pointer.

    There should be no functional change resulting from this patch.

    Signed-off-by: Borislav Petkov

    Borislav Petkov
     
  • This is in preparation of removing ide_atapi_pc. Expose the buffer as an
    argument to ide_queue_pc_tail with later replacing it with local buffer
    or even kmalloc'ed one if needed due to stack usage constraints.

    Also, add the possibility of passing a NULL-ptr buffer for cmds which
    don't transfer data besides the cdb. While at it, switch to local buffer
    in idetape_get_mode_sense_results().

    There should be no functional change resulting from this patch.

    Signed-off-by: Borislav Petkov

    Borislav Petkov
     
  • This is in preparation for removing ide_atapi_pc.

    There should be no functional change resulting from this patch.

    Signed-off-by: Borislav Petkov

    Borislav Petkov
     
  • Now that we have rq->resid_len, use it to account partial completion
    amount during the lifetime of an rq, decrementing it on each successful
    transfer. As a result, get rid of now unused pc->xferred.

    While at it, remove noisy debug call in ide_prep_sense.

    Signed-off-by: Borislav Petkov

    Borislav Petkov
     
  • After the recent struct request cleanups, blk_rq_bytes() is guaranteed
    to be valid and is the current total length of the rq's bio. Use that
    instead of pc->req_xfer in the do_request() path after the command has
    been queued

    The remaining usage of pc->req_xfer now is only until we map the rq to a
    bio.

    While at it:

    - remove local caching of rq completion length in ide_tape_issue_pc()

    Signed-off-by: Borislav Petkov

    Borislav Petkov
     

11 May, 2009

4 commits

  • Till now block layer allowed two separate modes of request execution.
    A request is always acquired from the request queue via
    elv_next_request(). After that, drivers are free to either dequeue it
    or process it without dequeueing. Dequeue allows elv_next_request()
    to return the next request so that multiple requests can be in flight.

    Executing requests without dequeueing has its merits mostly in
    allowing drivers for simpler devices which can't do sg to deal with
    segments only without considering request boundary. However, the
    benefit this brings is dubious and declining while the cost of the API
    ambiguity is increasing. Segment based drivers are usually for very
    old or limited devices and as converting to dequeueing model isn't
    difficult, it doesn't justify the API overhead it puts on block layer
    and its more modern users.

    Previous patches converted all block low level drivers to dequeueing
    model. This patch completes the API transition by...

    * renaming elv_next_request() to blk_peek_request()

    * renaming blkdev_dequeue_request() to blk_start_request()

    * adding blk_fetch_request() which is combination of peek and start

    * disallowing completion of queued (not started) requests

    * applying new API to all LLDs

    Renamings are for consistency and to break out of tree code so that
    it's apparent that out of tree drivers need updating.

    [ Impact: block request issue API cleanup, no functional change ]

    Signed-off-by: Tejun Heo
    Cc: Rusty Russell
    Cc: James Bottomley
    Cc: Mike Miller
    Cc: unsik Kim
    Cc: Paul Clements
    Cc: Tim Waugh
    Cc: Geert Uytterhoeven
    Cc: David S. Miller
    Cc: Laurent Vivier
    Cc: Jeff Garzik
    Cc: Jeremy Fitzhardinge
    Cc: Grant Likely
    Cc: Adrian McMenamin
    Cc: Stephen Rothwell
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Borislav Petkov
    Cc: Sergei Shtylyov
    Cc: Alex Dubov
    Cc: Pierre Ossman
    Cc: David Woodhouse
    Cc: Markus Lidel
    Cc: Stefan Weinhuber
    Cc: Martin Schwidefsky
    Cc: Pete Zaitcev
    Cc: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • ide generally has single request in flight and tracks it using
    hwif->rq and all state handlers follow the following convention.

    * ide_started is returned if the request is in flight.

    * ide_stopped is returned if the queue needs to be restarted. The
    request might or might not have been processed fully or partially.

    * hwif->rq is set to NULL, when an issued request completes.

    So, dequeueing model can be implemented by dequeueing after fetch,
    requeueing if hwif->rq isn't NULL on ide_stopped return and doing
    about the same thing on completion / port unlock paths. These changes
    can be made in ide-io proper.

    In addition to the above main changes, the following updates are
    necessary.

    * ide-cd shouldn't dequeue a request when issuing REQUEST SENSE for it
    as the request is already dequeued.

    * ide-atapi uses request queue as stack when issuing REQUEST SENSE to
    put the REQUEST SENSE in front of the failed request. This now
    needs to be done using requeueing.

    [ Impact: dequeue in-flight request ]

    Signed-off-by: Tejun Heo
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Borislav Petkov
    Cc: Sergei Shtylyov
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • With recent unification of fields, it's now guaranteed that
    rq->data_len always equals blk_rq_bytes(). Convert all direct users
    to accessors.

    [ Impact: convert direct rq->data_len usages to blk_rq_bytes() ]

    Signed-off-by: Tejun Heo
    Acked-by: Bartlomiej Zolnierkiewicz
    Cc: Borislav Petkov
    Cc: Sergei Shtylyov
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • rq->data_len served two purposes - the length of data buffer on issue
    and the residual count on completion. This duality creates some
    headaches.

    First of all, block layer and low level drivers can't really determine
    what rq->data_len contains while a request is executing. It could be
    the total request length or it coulde be anything else one of the
    lower layers is using to keep track of residual count. This
    complicates things because blk_rq_bytes() and thus
    [__]blk_end_request_all() relies on rq->data_len for PC commands.
    Drivers which want to report residual count should first cache the
    total request length, update rq->data_len and then complete the
    request with the cached data length.

    Secondly, it makes requests default to reporting full residual count,
    ie. reporting that no data transfer occurred. The residual count is
    an exception not the norm; however, the driver should clear
    rq->data_len to zero to signify the normal cases while leaving it
    alone means no data transfer occurred at all. This reverse default
    behavior complicates code unnecessarily and renders block PC on some
    drivers (ide-tape/floppy) unuseable.

    This patch adds rq->resid_len which is used only for residual count.

    While at it, remove now unnecessasry blk_rq_bytes() caching in
    ide_pc_intr() as rq->data_len is not changed anymore.

    Boaz : spotted missing conversion in osd
    Sergei : spotted too early conversion to blk_rq_bytes() in ide-tape

    [ Impact: cleanup residual count handling, report 0 resid by default ]

    Signed-off-by: Tejun Heo
    Cc: James Bottomley
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Borislav Petkov
    Cc: Sergei Shtylyov
    Cc: Mike Miller
    Cc: Eric Moore
    Cc: Alan Stern
    Cc: FUJITA Tomonori
    Cc: Doug Gilbert
    Cc: Mike Miller
    Cc: Eric Moore
    Cc: Darrick J. Wong
    Cc: Pete Zaitcev
    Cc: Boaz Harrosh
    Signed-off-by: Jens Axboe

    Tejun Heo
     

28 Apr, 2009

7 commits

  • Impact: remove fields and code paths which are no longer necessary

    Now that ide-tape uses standard mechanisms to transfer data, special
    case handling for bh handling can be dropped from ide-atapi. Drop the
    followings.

    * pc->cur_pos, b_count, bh and b_data
    * drive->pc_update_buffers() and pc_io_buffers().

    Signed-off-by: Tejun Heo

    Tejun Heo
     
  • Impact: use standard way to transfer data

    ide-tape uses rq in an interesting way. For r/w requests, rq->special
    is used to carry a private buffer management structure idetape_bh and
    rq->nr_sectors and current_nr_sectors are initialized to the number of
    idetape blocks which isn't necessary 512 bytes. Also,
    rq->current_nr_sectors is used to report back the residual count in
    units of idetape blocks.

    This peculiarity taxes both block layer and ide. ide-atapi has
    different paths and hooks to accomodate it and what a rq means becomes
    quite confusing and making changes at the block layer becomes quite
    difficult and error-prone.

    This patch makes ide-tape use bio instead. With the previous patch,
    ide-tape currently is using single contiguos buffer so replacing it
    isn't difficult. Data buffer is mapped into bio using
    blk_rq_map_kern() in idetape_queue_rw_tail(). idetape_io_buffers()
    and idetape_update_buffers() are dropped and pc->bh is set to null to
    tell ide-atapi to use standard data transfer mechanism and idetape_bh
    byte counts are updated by the issuer on completion using the residual
    count.

    This change also nicely removes the FIXME in ide_pc_intr() where
    ide-tape rqs need to be completed using ide_rq_bytes() instead of
    blk_rq_bytes() (although this didn't really matter as the request
    didn't have bio).

    Signed-off-by: Tejun Heo
    Cc: Jens Axboe

    Tejun Heo
     
  • Impact: allow residual count implementation in ->pc_callback()

    rq->data_len has two duties - carrying the number of input bytes on
    issue and carrying residual count back to the issuer on completion.
    ide-atapi completion callback ->pc_callback() is the right place to do
    this but currently ide-atapi depends on rq->data_len carrying the
    original request size after calling ->pc_callback() to complete the pc
    request.

    This patch makes ide_pc_intr(), ide_tape_issue_pc() and
    ide_floppy_issue_pc() cache length to complete before calling
    ->pc_callback() so that it can modify rq->data_len as necessary.

    Note: As using rq->data_len for two purposes can make cases like this
    incorrect in subtle ways, future changes will introduce separate
    field for residual count.

    Signed-off-by: Tejun Heo
    Cc: Jens Axboe

    Tejun Heo
     
  • Impact: unify request data buffer handling

    rq->data is used mostly to pass kernel buffer through request queue
    without using bio. There are only a couple of places which still do
    this in kernel and converting to bio isn't difficult.

    This patch converts ide-cd and atapi to use bio instead of rq->data
    for request sense and internal pc commands. With previous change to
    unify sense request handling, this is relatively easily achieved by
    adding blk_rq_map_kern() during sense_rq prep and PC issue.

    If blk_rq_map_kern() fails for sense, the error is deferred till sense
    issue and aborts the failed command which triggered the sense. Note
    that this is a slim possibility as sense prep is done on each command
    issue, so for the above condition to actually trigger, all preps since
    the last sense issue till the issue of the request which would require
    a sense should fail.

    * do_request functions might sleep now. This should be okay as ide
    request_fn - do_ide_request() - is invoked only from make_request
    and plug work. Make sure this is the case by adding might_sleep()
    to do_ide_request().

    * Functions which access the read sense data before the sense request
    is complete now should access bio_data(sense_rq->bio) as the sense
    buffer might have been copied during blk_rq_map_kern().

    * ide-tape updated to map sg.

    * cdrom_do_block_pc() now doesn't have to deal with REQ_TYPE_ATA_PC
    special case. Simplified.

    * tp_ops->output/input_data path dropped from ide_pc_intr().

    Signed-off-by: Tejun Heo

    Tejun Heo
     
  • Since we're issuing REQ_TYPE_SENSE now we need to allow those types of
    rqs in the ->do_request callbacks. As a future improvement, sense_len
    assignment might be unified across all ATAPI devices. Borislav to
    check with specs and test.

    As a result, get rid of ide_queue_pc_head() and
    drive->request_sense_rq.

    tj: * Init request sense ide_atapi_pc from sense request. In the
    longer timer, it would probably better to fold
    ide_create_request_sense_cmd() into its only current user -
    ide_floppy_get_format_progress().

    * ide_retry_pc() no longer takes @disk.

    CC: Bartlomiej Zolnierkiewicz
    CC: FUJITA Tomonori
    Signed-off-by: Borislav Petkov
    Signed-off-by: Tejun Heo

    Borislav Petkov
     
  • This is in preparation of removing the queueing of a sense request out
    of the IRQ handler path.

    Use struct request_sense as a general sense buffer for all ATAPI
    devices ide-{floppy,tape,cd}.

    tj: * blk_get_request(__GFP_WAIT) can't be called from do_request() as
    it can cause deadlock. Converted to use inline struct request
    and blk_rq_init().

    * Added xfer / cdb len selection depending on device type.

    * All sense prep logics folded into ide_prep_sense() which never
    fails.

    * hwif->rq clearing and sense_rq used handling moved into
    ide_queue_sense_rq().

    * blk_rq_map_kern() conversion is moved to later patch.

    CC: Bartlomiej Zolnierkiewicz
    CC: FUJITA Tomonori
    Signed-off-by: Borislav Petkov
    Signed-off-by: Tejun Heo

    Borislav Petkov
     
  • Impact: rq->buffer usage cleanup

    ide-atapi uses rq->buffer as private opaque value for internal special
    requests. rq->special isn't used for these cases (the only case where
    rq->special is used is for ide-tape rw requests). Use rq->special
    instead.

    Signed-off-by: Tejun Heo
    Cc: Jens Axboe

    Tejun Heo
     

19 Apr, 2009

5 commits

  • Impact: remove fields and code paths which are no longer necessary

    Now that ide-tape uses standard mechanisms to transfer data, special
    case handling for bh handling can be dropped from ide-atapi. Drop the
    followings.

    * pc->cur_pos, b_count, bh and b_data
    * drive->pc_update_buffers() and pc_io_buffers().

    Signed-off-by: Tejun Heo

    Tejun Heo
     
  • Impact: use standard way to transfer data

    ide-tape uses rq in an interesting way. For r/w requests, rq->special
    is used to carry a private buffer management structure idetape_bh and
    rq->nr_sectors and current_nr_sectors are initialized to the number of
    idetape blocks which isn't necessary 512 bytes. Also,
    rq->current_nr_sectors is used to report back the residual count in
    units of idetape blocks.

    This peculiarity taxes both block layer and ide. ide-atapi has
    different paths and hooks to accomodate it and what a rq means becomes
    quite confusing and making changes at the block layer becomes quite
    difficult and error-prone.

    This patch makes ide-tape use bio instead. With the previous patch,
    ide-tape currently is using single contiguos buffer so replacing it
    isn't difficult. Data buffer is mapped into bio using
    blk_rq_map_kern() in idetape_queue_rw_tail(). idetape_io_buffers()
    and idetape_update_buffers() are dropped and pc->bh is set to null to
    tell ide-atapi to use standard data transfer mechanism and idetape_bh
    byte counts are updated by the issuer on completion using the residual
    count.

    This change also nicely removes the FIXME in ide_pc_intr() where
    ide-tape rqs need to be completed using ide_rq_bytes() instead of
    blk_rq_bytes() (although this didn't really matter as the request
    didn't have bio).

    Signed-off-by: Tejun Heo
    Cc: Jens Axboe

    Tejun Heo
     
  • Impact: allow residual count implementation in ->pc_callback()

    rq->data_len has two duties - carrying the number of input bytes on
    issue and carrying residual count back to the issuer on completion.
    ide-atapi completion callback ->pc_callback() is the right place to do
    this but currently ide-atapi depends on rq->data_len carrying the
    original request size after calling ->pc_callback() to complete the pc
    request.

    This patch makes ide_pc_intr(), ide_tape_issue_pc() and
    ide_floppy_issue_pc() cache length to complete before calling
    ->pc_callback() so that it can modify rq->data_len as necessary.

    Note: As using rq->data_len for two purposes can make cases like this
    incorrect in subtle ways, future changes will introduce separate
    field for residual count.

    Signed-off-by: Tejun Heo
    Cc: Jens Axboe

    Tejun Heo
     
  • Impact: unify request data buffer handling

    rq->data is used mostly to pass kernel buffer through request queue
    without using bio. There are only a couple of places which still do
    this in kernel and converting to bio isn't difficult.

    This patch converts ide-cd and atapi to use bio instead of rq->data
    for request sense and internal pc commands. With previous change to
    unify sense request handling, this is relatively easily achieved by
    adding blk_rq_map_kern() during sense_rq prep and PC issue.

    If blk_rq_map_kern() fails for sense, the error is deferred till sense
    issue and aborts the failed command which triggered the sense. Note
    that this is a slim possibility as sense prep is done on each command
    issue, so for the above condition to actually trigger, all preps since
    the last sense issue till the issue of the request which would require
    a sense should fail.

    * do_request functions might sleep now. This should be okay as ide
    request_fn - do_ide_request() - is invoked only from make_request
    and plug work. Make sure this is the case by adding might_sleep()
    to do_ide_request().

    * Functions which access the read sense data before the sense request
    is complete now should access bio_data(sense_rq->bio) as the sense
    buffer might have been copied during blk_rq_map_kern().

    * ide-tape updated to map sg.

    * cdrom_do_block_pc() now doesn't have to deal with REQ_TYPE_ATA_PC
    special case. Simplified.

    * tp_ops->output/input_data path dropped from ide_pc_intr().

    Signed-off-by: Tejun Heo

    Tejun Heo
     
  • Since we're issuing REQ_TYPE_SENSE now we need to allow those types of
    rqs in the ->do_request callbacks. As a future improvement, sense_len
    assignment might be unified across all ATAPI devices. Borislav to
    check with specs and test.

    As a result, get rid of ide_queue_pc_head() and
    drive->request_sense_rq.

    tj: * Init request sense ide_atapi_pc from sense request. In the
    longer timer, it would probably better to fold
    ide_create_request_sense_cmd() into its only current user -
    ide_floppy_get_format_progress().

    * ide_retry_pc() no longer takes @disk.

    CC: Bartlomiej Zolnierkiewicz
    CC: FUJITA Tomonori
    Signed-off-by: Borislav Petkov
    Signed-off-by: Tejun Heo

    Borislav Petkov