09 Nov, 2011

1 commit

  • The top of has this comment:

    * Please do not include this file in generic code. There is currently
    * no requirement for any architecture to implement anything held
    * within this file.
    *
    * Thanks. --rmk

    Remove inclusion of , to prevent the following compile error
    from happening soon:

    | include/linux/irq.h:132: error: redefinition of ‘struct irq_data’
    | include/linux/irq.h:286: error: redefinition of ‘struct irq_chip’

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Thomas Gleixner
    Acked-by: Borislav Petkov
    Cc: linux-ide@vger.kernel.org

    Geert Uytterhoeven
     

23 Oct, 2010

1 commit

  • * 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
    vfs: make no_llseek the default
    vfs: don't use BKL in default_llseek
    llseek: automatically add .llseek fop
    libfs: use generic_file_llseek for simple_attr
    mac80211: disallow seeks in minstrel debug code
    lirc: make chardev nonseekable
    viotape: use noop_llseek
    raw: use explicit llseek file operations
    ibmasmfs: use generic_file_llseek
    spufs: use llseek in all file operations
    arm/omap: use generic_file_llseek in iommu_debug
    lkdtm: use generic_file_llseek in debugfs
    net/wireless: use generic_file_llseek in debugfs
    drm: use noop_llseek

    Linus Torvalds
     

15 Oct, 2010

1 commit

  • All file_operations should get a .llseek operation so we can make
    nonseekable_open the default for future file operations without a
    .llseek pointer.

    The three cases that we can automatically detect are no_llseek, seq_lseek
    and default_llseek. For cases where we can we can automatically prove that
    the file offset is always ignored, we use noop_llseek, which maintains
    the current behavior of not returning an error from a seek.

    New drivers should normally not use noop_llseek but instead use no_llseek
    and call nonseekable_open at open time. Existing drivers can be converted
    to do the same when the maintainer knows for certain that no user code
    relies on calling seek on the device file.

    The generated code is often incorrectly indented and right now contains
    comments that clarify for each added line why a specific variant was
    chosen. In the version that gets submitted upstream, the comments will
    be gone and I will manually fix the indentation, because there does not
    seem to be a way to do that using coccinelle.

    Some amount of new code is currently sitting in linux-next that should get
    the same modifications, which I will do at the end of the merge window.

    Many thanks to Julia Lawall for helping me learn to write a semantic
    patch that does all this.

    ===== begin semantic patch =====
    // This adds an llseek= method to all file operations,
    // as a preparation for making no_llseek the default.
    //
    // The rules are
    // - use no_llseek explicitly if we do nonseekable_open
    // - use seq_lseek for sequential files
    // - use default_llseek if we know we access f_pos
    // - use noop_llseek if we know we don't access f_pos,
    // but we still want to allow users to call lseek
    //
    @ open1 exists @
    identifier nested_open;
    @@
    nested_open(...)
    {

    }

    @ open exists@
    identifier open_f;
    identifier i, f;
    identifier open1.nested_open;
    @@
    int open_f(struct inode *i, struct file *f)
    {

    }

    @ read disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {

    }

    @ read_no_fpos disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ write @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {

    }

    @ write_no_fpos @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ fops0 @
    identifier fops;
    @@
    struct file_operations fops = {
    ...
    };

    @ has_llseek depends on fops0 @
    identifier fops0.fops;
    identifier llseek_f;
    @@
    struct file_operations fops = {
    ...
    .llseek = llseek_f,
    ...
    };

    @ has_read depends on fops0 @
    identifier fops0.fops;
    identifier read_f;
    @@
    struct file_operations fops = {
    ...
    .read = read_f,
    ...
    };

    @ has_write depends on fops0 @
    identifier fops0.fops;
    identifier write_f;
    @@
    struct file_operations fops = {
    ...
    .write = write_f,
    ...
    };

    @ has_open depends on fops0 @
    identifier fops0.fops;
    identifier open_f;
    @@
    struct file_operations fops = {
    ...
    .open = open_f,
    ...
    };

    // use no_llseek if we call nonseekable_open
    ////////////////////////////////////////////
    @ nonseekable1 depends on !has_llseek && has_open @
    identifier fops0.fops;
    identifier nso ~= "nonseekable_open";
    @@
    struct file_operations fops = {
    ... .open = nso, ...
    +.llseek = no_llseek, /* nonseekable */
    };

    @ nonseekable2 depends on !has_llseek @
    identifier fops0.fops;
    identifier open.open_f;
    @@
    struct file_operations fops = {
    ... .open = open_f, ...
    +.llseek = no_llseek, /* open uses nonseekable */
    };

    // use seq_lseek for sequential files
    /////////////////////////////////////
    @ seq depends on !has_llseek @
    identifier fops0.fops;
    identifier sr ~= "seq_read";
    @@
    struct file_operations fops = {
    ... .read = sr, ...
    +.llseek = seq_lseek, /* we have seq_read */
    };

    // use default_llseek if there is a readdir
    ///////////////////////////////////////////
    @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier readdir_e;
    @@
    // any other fop is used that changes pos
    struct file_operations fops = {
    ... .readdir = readdir_e, ...
    +.llseek = default_llseek, /* readdir is present */
    };

    // use default_llseek if at least one of read/write touches f_pos
    /////////////////////////////////////////////////////////////////
    @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read.read_f;
    @@
    // read fops use offset
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = default_llseek, /* read accesses f_pos */
    };

    @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ... .write = write_f, ...
    + .llseek = default_llseek, /* write accesses f_pos */
    };

    // Use noop_llseek if neither read nor write accesses f_pos
    ///////////////////////////////////////////////////////////

    @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    identifier write_no_fpos.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ...
    .write = write_f,
    .read = read_f,
    ...
    +.llseek = noop_llseek, /* read and write both use no f_pos */
    };

    @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write_no_fpos.write_f;
    @@
    struct file_operations fops = {
    ... .write = write_f, ...
    +.llseek = noop_llseek, /* write uses no f_pos */
    };

    @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    @@
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = noop_llseek, /* read uses no f_pos */
    };

    @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    @@
    struct file_operations fops = {
    ...
    +.llseek = noop_llseek, /* no read or write fn */
    };
    ===== End semantic patch =====

    Signed-off-by: Arnd Bergmann
    Cc: Julia Lawall
    Cc: Christoph Hellwig

    Arnd Bergmann
     

05 Oct, 2010

1 commit

  • The block device drivers have all gained new lock_kernel
    calls from a recent pushdown, and some of the drivers
    were already using the BKL before.

    This turns the BKL into a set of per-driver mutexes.
    Still need to check whether this is safe to do.

    file=$1
    name=$2
    if grep -q lock_kernel ${file} ; then
    if grep -q 'include.*linux.mutex.h' ${file} ; then
    sed -i '/include.*/d' ${file}
    else
    sed -i 's/include.*.*$/include /g' ${file}
    fi
    sed -i ${file} \
    -e "/^#include.*linux.mutex.h/,$ {
    1,/^\(static\|int\|long\)/ {
    /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);

    } }" \
    -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
    -e '/[ ]*cycle_kernel_lock();/d'
    else
    sed -i -e '/include.*\/d' ${file} \
    -e '/cycle_kernel_lock()/d'
    fi

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

08 Aug, 2010

3 commits

  • The open and release block_device_operations are currently
    called with the BKL held. In order to change that, we must
    first make sure that all drivers that currently rely
    on this have no regressions.

    This blindly pushes the BKL into all .open and .release
    operations for all block drivers to prepare for the
    next step. The drivers can subsequently replace the BKL
    with their own locks or remove it completely when it can
    be shown that it is not needed.

    The functions blkdev_get and blkdev_put are the only
    remaining users of the big kernel lock in the block
    layer, besides a few uses in the ioctl code, none
    of which need to serialize with blkdev_{get,put}.

    Most of these two functions is also under the protection
    of bdev->bd_mutex, including the actual calls to
    ->open and ->release, and the common code does not
    access any global data structures that need the BKL.

    Signed-off-by: Arnd Bergmann
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Arnd Bergmann
     
  • As a preparation for the removal of the big kernel
    lock in the block layer, this removes the BKL
    from the common ioctl handling code, moving it
    into every single driver still using it.

    Signed-off-by: Arnd Bergmann
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Arnd Bergmann
     
  • Remove all the trivial wrappers for the cmd_type and cmd_flags fields in
    struct requests. This allows much easier grepping for different request
    types instead of unwinding through macros.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

12 Jan, 2010

1 commit


29 Oct, 2009

1 commit


22 Sep, 2009

1 commit


02 Sep, 2009

1 commit

  • ->read_proc, ->write_proc are going away, ->proc_fops should be used instead.

    The only tricky place is IDENTIFY handling: if for some reason
    taskfile_lib_get_identify() fails, buffer _is_ changed and at least
    first byte is overwritten. Emulate old behaviour with returning
    that first byte to userspace and reporting length=1 despite overall -E.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: David S. Miller

    Alexey Dobriyan
     

08 Aug, 2009

3 commits

  • ide-tape used to hit

    [ 58.614854] ide-tape: ht0: BUG: Two DSC requests queued!

    due to the fact that another rq was being issued while the driver was
    waiting for DSC to get set for the device executing ATAPI commands which
    set the DSC to 1 to indicate completion.

    Here's a sample output of that case:

    issue REZERO_UNIT

    [ 143.088505] ide-tape: ide_tape_issue_pc: retry #0, cmd: 0x01
    [ 143.095122] ide: Enter ide_pc_intr - interrupt handler
    [ 143.096118] ide: Packet command completed, 0 bytes transferred
    [ 143.106319] ide-tape: ide_tape_callback: cmd: 0x1, dsc: 1, err: 0
    [ 143.112601] ide-tape: idetape_postpone_request: cmd: 0x1, dsc_poll_freq: 2000

    we stall the ide-tape queue here waiting for DSC

    [ 143.119936] ide-tape: ide_tape_read_position: enter
    [ 145.119019] ide-tape: idetape_do_request: sector: 4294967295, nr_sectors: 0

    and issue the new READ_POSITION rq and hit the check.

    [ 145.126247] ide-tape: ht0: BUG: Two DSC requests queued!
    [ 145.131748] ide-tape: ide_tape_read_position: BOP - No
    [ 145.137059] ide-tape: ide_tape_read_position: EOP - No

    Also, ->postponed_rq used to point to that postponed request. To make
    things worse, in certain circumstances the rq it was pointing to got
    replaced unterneath it by swiftly reusing the same rq from the mempool
    of the block layer practically confusing stuff even more.

    However, we don't need to keep a pointer to that rq but simply wait for
    DSC to be set first before issuing the follow-up request in the drive's
    queue. In order to do that, we make idetape_do_request() first check the
    DSC and if not set, we stall the drive queue giving the other device on
    that IDE channel a chance.

    Signed-off-by: Borislav Petkov
    Signed-off-by: David S. Miller

    Borislav Petkov
     
  • Remove tape->debug_mask and use drive->debug_mask instead.

    There should be no functional change resulting from this patch.

    Signed-off-by: Borislav Petkov
    Signed-off-by: David S. Miller

    Borislav Petkov
     
  • This error only occurs when IDETAPE_DEBUG_LOG is enabled.

    Signed-off-by: Mark de Wever
    Signed-off-by: David S. Miller

    Mark de Wever
     

22 Jul, 2009

1 commit


16 Jun, 2009

2 commits

  • Unsupported requests should be never handed down to device drivers
    and the best thing we can do upon discovering such request inside
    driver's ->do_request method is to just BUG().

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • This fixes

    drivers/ide/ide-tape.c: In function `idetape_chrdev_open':
    drivers/ide/ide-tape.c:1515: error: implicit declaration of function `idetape_read_position'
    make[1]: *** [drivers/ide/ide-tape.o] Error 1

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     

13 Jun, 2009

2 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
     

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
     

09 Jun, 2009

1 commit

  • ide_tape_chrdev_get() was missing an ide_device_get() refcount increment
    which lead to the following warning:

    [ 278.147906] ------------[ cut here ]------------
    [ 278.152685] WARNING: at fs/proc/generic.c:847 remove_proc_entry+0x199/0x1b8()
    [ 278.160070] Hardware name: P4I45PE 1.00
    [ 278.160076] remove_proc_entry: removing non-empty directory 'ide0/hdb', leaking at least 'name'
    [ 278.160080] Modules linked in: rtc intel_agp pcspkr thermal processor thermal_sys parport_pc parport agpgart button
    [ 278.160100] Pid: 2312, comm: mt Not tainted 2.6.30-rc2 #3
    [ 278.160105] Call Trace:
    [ 278.160117] [] warn_slowpath+0x71/0xa0
    [ 278.160126] [] ? _spin_unlock_irqrestore+0x29/0x2c
    [ 278.160132] [] ? try_to_wake_up+0x1b6/0x1c0
    [ 278.160141] [] ? default_wake_function+0xb/0xd
    [ 278.160149] [] ? pollwake+0x4a/0x55
    [ 278.160156] [] ? _spin_unlock+0x24/0x26
    [ 278.160163] [] ? add_partial+0x44/0x49
    [ 278.160169] [] ? __slab_free+0xba/0x29c
    [ 278.160177] [] ? sysfs_delete_inode+0x0/0x3c
    [ 278.160184] [] remove_proc_entry+0x199/0x1b8
    [ 278.160191] [] ? remove_dir+0x27/0x2e
    [ 278.160199] [] ide_proc_unregister_device+0x40/0x4c
    [ 278.160207] [] drive_release_dev+0x14/0x47
    [ 278.160214] [] device_release+0x35/0x5a
    [ 278.160221] [] kobject_release+0x40/0x50
    [ 278.160226] [] ? kobject_release+0x0/0x50
    [ 278.160232] [] kref_put+0x3c/0x4a
    [ 278.160238] [] kobject_put+0x37/0x3c
    [ 278.160243] [] put_device+0xf/0x11
    [ 278.160249] [] ide_device_put+0x2d/0x30
    [ 278.160255] [] ide_tape_put+0x24/0x32
    [ 278.160261] [] idetape_chrdev_release+0x17f/0x18e
    [ 278.160269] [] __fput+0xca/0x175
    [ 278.160275] [] fput+0x19/0x1b
    [ 278.160280] [] filp_close+0x51/0x5b
    [ 278.160286] [] sys_close+0x73/0xad
    [ 278.160293] [] syscall_call+0x7/0xb
    [ 278.160298] ---[ end trace f16d907ea1f89336 ]---

    Instead of trivially fixing it by adding the missing call,
    ide_tape_chrdev_get() and ide_tape_get() were merged into one function
    since both were almost identical. The only difference was that
    ide_tape_chrdev_get() was accessing the ide-tape reference through the
    idetape_devs[] array of minors instead of through the gendisk.

    Accomodate that by adding two additional parameters to ide_tape_get() to
    annotate the call site and invoke the proper behavior.

    As a result, remove ide_tape_chrdev_get().

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     

07 Jun, 2009

2 commits


19 May, 2009

1 commit

  • In commit c3a4d78c580de4edc9ef0f7c59812fb02ceb037f, while introducing
    rq->resid_len, the default value of residue count was changed from
    full count to zero. The conversion was done under the assumption that
    when a request fails residue count wasn't defined. However, Boaz and
    James pointed out that this wasn't true and the residue count should
    be preserved for failed requests too.

    This patchset restores the original behavior by setting rq->resid_len
    to blk_rq_bytes(rq) on request start and restoring explicit clearing
    in affected drivers. While at it, take advantage of the fact that
    rq->resid_len is set to full count where applicable.

    * ide-cd: rq->resid_len cleared on pc success

    * mptsas: req->resid_len cleared on success

    * sas_expander: rsp/req->resid_len cleared on success

    * mpt2sas_transport: req->resid_len cleared on success

    * ide-cd, ide-tape, mptsas, sas_host_smp, mpt2sas_transport, ub: take
    advantage of initial full count to simplify code

    Boaz Harrosh spotted bug in resid_len initialization. Fixed as
    suggested.

    Signed-off-by: Tejun Heo
    Acked-by: Borislav Petkov
    Cc: Boaz Harrosh
    Cc: James Bottomley
    Cc: Pete Zaitcev
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Sergei Shtylyov
    Cc: Eric Moore
    Cc: Darrick J. Wong
    Signed-off-by: Jens Axboe

    Tejun Heo
     

17 May, 2009

1 commit


15 May, 2009

9 commits

  • 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
     
  • ide-tape used to issue READ POSITION in several places and the
    evaluation of the returned READ POSITION data was done in the
    ->pc_callback. Convert it to use local buffer and move that
    evaluation chunk in the idetape_read_position(). Additionally, fold
    idetape_create_read_position_cmd() into it, too, thus concentrating READ
    POSITION handling in one method only and making all places call that.

    Finally, mv {idetape,ide_tape}_read_position.

    There should be no functional change resulting from this patch.

    Signed-off-by: Borislav Petkov

    Borislav Petkov
     
  • 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
     
  • ide-tape had a potential bug for fs requests when preparing the command
    packet: it was writing the transfer length as a number of fixed blocks.
    However, the block layer implies 512 byte blocks and ide-tape can have
    other block sizes so account for that too.

    ide-floppy does this calculation properly with the block size factor
    (floppy->bs_factor).

    Signed-off-by: Borislav Petkov

    Borislav Petkov
     

11 May, 2009

4 commits

  • 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
     
  • ide doesn't manipulate request fields anymore and thus all hard and
    their soft equivalents are always equal. Convert all references to
    accessors.

    [ Impact: use pos and nr_sectors accessors ]

    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
     
  • rq->sector is set to the tape->first_frame but it's never actually
    used and not even in the correct unit (512 byte sectors). Don't set
    it.

    [ Impact: cleanup ]

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

    Tejun Heo
     

28 Apr, 2009

2 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: cleanup

    idetape_chrdev_read/write() functions are unnecessarily complex when
    everything can be handled in a single loop. Collapse
    idetape_add_chrdev_read/write_request() into the rw functions and
    simplify the implementation.

    Signed-off-by: Tejun Heo

    Tejun Heo