23 Apr, 2008

1 commit

  • This patch adds release callback support, which is called when a bsg
    device goes away. bsg_register_queue() takes a pointer to a callback
    function. This feature is useful for stuff like sas_host that can't
    use the release callback in struct device.

    If a caller doesn't need bsg's release callback, it can call
    bsg_register_queue() with NULL pointer (e.g. scsi devices can use
    release callback in struct device so they don't need bsg's callback).

    With this patch, bsg uses kref for refcounts on bsg devices instead of
    get/put_device in fops->open/release. bsg calls put_device and the
    caller's release callback (if it was registered) in kref_put's
    release.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     

22 Apr, 2008

1 commit

  • * 'for-2.6.26' of git://git.kernel.dk/linux-2.6-block:
    block: fix blk_register_queue() return value
    block: fix memory hotplug and bouncing in block layer
    block: replace remaining __FUNCTION__ occurrences
    Kconfig: clean up block/Kconfig help descriptions
    cciss: fix warning oops on rmmod of driver
    cciss: Fix race between disk-adding code and interrupt handler
    block: move the padding adjustment to blk_rq_map_sg
    block: add bio_copy_user_iov support to blk_rq_map_user_iov
    block: convert bio_copy_user to bio_copy_user_iov
    loop: manage partitions in disk image
    cdrom: use kmalloced buffers instead of buffers on stack
    cdrom: make unregister_cdrom() return void
    cdrom: use list_head for cdrom_device_info list
    cdrom: protect cdrom_device_info list by mutex
    cdrom: cleanup hardcoded error-code
    cdrom: remove ifdef CONFIG_SYSCTL

    Linus Torvalds
     

21 Apr, 2008

4 commits

  • blk_register_queue() returns -ENXIO when queue->request_fn is NULL. But there
    are some block drivers that call blk_register_queue() via add_disk() with
    queue->request_fn == NULL. (For example, brd, loop)

    Although no one checks return value of blk_register_queue(), this patch makes
    it return 0 instead of -ENXIO when queue->request_fn is NULL,

    Also this patch adds warning when blk_register_queue() and
    blk_unregister_queue() are called with queue == NULL rather than ignore
    invalid usage silently.

    Signed-off-by: Akinobu Mita
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Jens Axboe

    Akinobu Mita
     
  • Modify the help descriptions of block/Kconfig for clarity, accuracy and
    consistency.

    Refactor the BLOCK description a bit. The wording "This permits ... to be
    removed" isn't quite right; the block layer is removed when the option is
    disabled, whereas most descriptions talk about what happens when the option is
    enabled. Reformat the list of what is affected by disabling the block layer.

    Add more examples of large block devices to LBD and strive for technical
    accuracy; block devices of size _exactly_ 2TB require CONFIG_LBD, not only
    "bigger than 2TB". Also try to say (perhaps not very clearly) that the config
    option is only needed when you want to have individual block devices of size
    >= 2TB, for example if you had 3 x 1TB disks in your computer you'd have a
    total storage size of 3TB but you wouldn't need the option unless you want to
    aggregate those disks into a RAID or LVM.

    Improve terminology and grammar on BLK_DEV_IO_TRACE.

    I also added the boilerplate "If unsure, say N" to most options.

    Precisely say "2TB and larger" for LSF.

    Indent the help text for BLK_DEV_BSG by 2 spaces in accordance with the
    standard.

    Signed-off-by: Nick Andrew
    Cc: "Randy.Dunlap"
    Signed-off-by: Andrew Morton
    Signed-off-by: Jens Axboe

    Nick Andrew
     
  • blk_rq_map_user adjusts bi_size of the last bio. It breaks the rule
    that req->data_len (the true data length) is equal to sum(bio). It
    broke the scsi command completion code.

    commit e97a294ef6938512b655b1abf17656cf2b26f709 was introduced to fix
    the above issue. However, the partial completion code doesn't work
    with it. The commit is also a layer violation (scsi mid-layer should
    not know about the block layer's padding).

    This patch moves the padding adjustment to blk_rq_map_sg (suggested by
    James). The padding works like the drain buffer. This patch breaks the
    rule that req->data_len is equal to sum(sg), however, the drain buffer
    already broke it. So this patch just restores the rule that
    req->data_len is equal to sub(bio) without breaking anything new.

    Now when a low level driver needs padding, blk_rq_map_user and
    blk_rq_map_user_iov guarantee there's enough room for padding.
    blk_rq_map_sg can safely extend the last entry of a scatter list.

    blk_rq_map_sg must extend the last entry of a scatter list only for a
    request that got through bio_copy_user_iov. This patches introduces
    new REQ_COPY_USER flag.

    Signed-off-by: FUJITA Tomonori
    Cc: Tejun Heo
    Cc: Mike Christie
    Cc: James Bottomley
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • With this patch, blk_rq_map_user_iov uses bio_copy_user_iov when a low
    level driver needs padding or a buffer in sg_iovec isn't aligned. That
    is, it uses temporary kernel buffers instead of mapping user pages
    directly.

    When a LLD needs padding, later blk_rq_map_sg needs to extend the last
    entry of a scatter list. bio_copy_user_iov guarantees that there is
    enough space for padding by using temporary kernel buffers instead of
    user pages.

    blk_rq_map_user_iov needs buffers in sg_iovec to be aligned. The
    comment in blk_rq_map_user_iov indicates that drivers/scsi/sg.c also
    needs buffers in sg_iovec to be aligned. Actually, drivers/scsi/sg.c
    works with unaligned buffers in sg_iovec (it always uses temporary
    kernel buffers).

    Signed-off-by: FUJITA Tomonori
    Cc: Tejun Heo
    Cc: Mike Christie
    Cc: James Bottomley
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     

20 Apr, 2008

1 commit


19 Apr, 2008

6 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (137 commits)
    [SCSI] iscsi: bidi support for iscsi_tcp
    [SCSI] iscsi: bidi support at the generic libiscsi level
    [SCSI] iscsi: extended cdb support
    [SCSI] zfcp: Fix error handling for blocked unit for send FCP command
    [SCSI] zfcp: Remove zfcp_erp_wait from slave destory handler to fix deadlock
    [SCSI] zfcp: fix 31 bit compile warnings
    [SCSI] bsg: no need to set BSG_F_BLOCK bit in bsg_complete_all_commands
    [SCSI] bsg: remove minor in struct bsg_device
    [SCSI] bsg: use better helper list functions
    [SCSI] bsg: replace kobject_get with blk_get_queue
    [SCSI] bsg: takes a ref to struct device in fops->open
    [SCSI] qla1280: remove version check
    [SCSI] libsas: fix endianness bug in sas_ata
    [SCSI] zfcp: fix compiler warning caused by poking inside new semaphore (linux-next)
    [SCSI] aacraid: Do not describe check_reset parameter with its value
    [SCSI] aacraid: Fix down_interruptible() to check the return value
    [SCSI] sun3_scsi_vme: add MODULE_LICENSE
    [SCSI] st: rename flush_write_buffer()
    [SCSI] tgt: use KMEM_CACHE macro
    [SCSI] initio: fix big endian problems for auto request sense
    ...

    Linus Torvalds
     
  • Before bsg_complete_all_commands is called, BSG_F_BLOCK bit is always
    set.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     
  • minor in struct bsg_device is used as identifier to find the
    corresponding struct bsg_device_class. However, request_queuse can be
    used as identifier for that and the minor in struct bsg_device is
    unnecessary.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     
  • This replace hlist_for_each and list_entry with hlist_for_each_entry
    and list_first_entry respectively.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     
  • Both takes a ref to a queue. But blk_get_queue checks QUEUE_FLAG_DEAD
    and is more appropriate interface here.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     
  • bsg_register_queue() takes a ref to struct device that a caller
    passes. For example, bsg takes a ref to the sdev_gendev for scsi
    devices. However, bsg doesn't inrease the refcount in fops->open. So
    while an application opens a bsg device, the scsi device that the bsg
    device holds can go away (bsg also takes a ref to a queue, but it
    doesn't prevent the device from going away).

    With this patch, bsg increases the refcount of struct device in
    fops->open and decreases it in fops->release.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     

18 Apr, 2008

1 commit

  • hdparm explicitely marks HDIO_[UNREGISTER,SCAN]_HWIF ioctls as DANGEROUS
    and given the number of bugs we can assume that there are no real users:

    * DMA has no chance of working because DMA resources are released by
    ide_unregister() and they are never allocated again.

    * Since ide_init_hwif_ports() is used for ->io_ports[] setup the ioctls
    don't work for almost all hosts with "non-standard" (== non ISA-like)
    layout of IDE taskfile registers (there is a lot of such host drivers).

    * ide_port_init_devices() is not called when probing IDE devices so:
    - drive->autotune is never set and IDE host/devices are not programmed
    for the correct PIO/DMA transfer modes (=> possible data corruption)
    - host specific I/O 32-bit and IRQ unmasking settings are not applied
    (=> possible data corruption)
    - host specific ->port_init_devs method is not called (=> no luck with
    ht6560b, qd65xx and opti621 host drivers)

    * ->rw_disk method is not preserved (=> no HPT3xxN chipsets support).

    * ->serialized flag is not preserved (=> possible data corruption when
    using icside, aec62xx (ATP850UF chipset), cmd640, cs5530, hpt366
    (HPT3xxN chipsets), rz1000, sc1200, dtc2278 and ht6560b host drivers).

    * ->ack_intr method is not preserved (=> needed by ide-cris, buddha,
    gayle and macide host drivers).

    * ->sata_scr[] and sata_misc[] is cleared by ide_unregister() and it
    isn't initialized again (SiI3112 support needs them).

    * To issue an ioctl() there need to be at least one IDE device present
    in the system.

    * ->cable_detect method is not preserved + it is not called when probing
    IDE devices so cable detection is broken (however since DMA support is
    also broken it doesn't really matter ;-).

    * Some objects which may have already been freed in ide_unregister()
    are restored by ide_hwif_restore() (i.e. ->hwgroup).

    * ide_register_hw() may unregister unrelated IDE ports if free ide_hwifs[]
    slot cannot be found.

    * When IDE host drivers are modular unregistered port may be re-used by
    different host driver that owned it first causing subtle bugs.

    Since we now have a proper warm-plug support remove these ioctls,
    then remove no longer needed:
    - ide_register_hw() and ide_hwif_restore() functions
    - 'init_default' and 'restore' arguments of ide_unregister()
    - zeroeing of hwif->{dma,extra}_* fields in ide_unregister()

    As an added bonus IDE core code size shrinks by ~3kB (x86-32).

    v2:
    * fix ide_unregister() arguments in cleanup_module() (Andrew Morton).

    v3:
    * fix ide_unregister() arguments in palm_bk3710.c.

    Acked-by: Sergei Shtylyov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     

15 Apr, 2008

1 commit


10 Apr, 2008

1 commit

  • When switching scheduler from cfq, cfq_exit_queue() does not clear
    ioc->ioc_data, leaving a dangling pointer that can deceive the following
    lookups when the iosched is switched back to cfq. The pattern that can
    trigger that is the following:

    - elevator switch from cfq to something else;
    - module unloading, with elv_unregister() that calls cfq_free_io_context()
    on ioc freeing the cic (via the .trim op);
    - module gets reloaded and the elevator switches back to cfq;
    - reallocation of a cic at the same address as before (with a valid key).

    To fix it just assign NULL to ioc_data in __cfq_exit_single_io_context(),
    that is called from the regular exit path and from the elevator switching
    code. The only path that frees a cic and is not covered is the error handling
    one, but cic's freed in this way are never cached in ioc_data.

    Signed-off-by: Fabio Checconi
    Signed-off-by: Jens Axboe

    Fabio Checconi
     

02 Apr, 2008

2 commits

  • SLAB_DESTROY_BY_RCU is not a direct substitute for normal call_rcu()
    freeing, since it'll page freeing but NOT object freeing. So change
    cfq to do the freeing on its own.

    Signed-off-by: Fabio Checconi
    Acked-by: Paul E. McKenney
    Signed-off-by: Jens Axboe

    Fabio Checconi
     
  • Looking a bit closer into this regression the reason this can't be
    right is that dma_addr common default is BLK_BOUNCE_HIGH and most
    machines have less than 4G. So if you do:

    if (b_pfn > PAGE_SHIFT))
    dma = 1

    that will translate to:

    if (BLK_BOUNCE_HIGH < blk_max_low_pfn.

    I guess this is what you were looking after. I didn't verify but as
    far as I can tell, this will stop the regression with isa dma
    operations at boot for 99% of blkdev/memory combinations out there and
    I guess this fixes the setups with >4G of ram and 32bit pci cards as
    well (this also retains symmetry with the 32bit code).

    Signed-off-by: Andrea Arcangeli
    Signed-off-by: Jens Axboe

    Andrea Arcangeli
     

13 Mar, 2008

1 commit

  • Fixes:

    block/genhd.c:361: warning: ignoring return value of ‘class_register’, declared with attribute warn_unused_result

    Signed-off-by: Roland McGrath
    Acked-by: Jeff Garzik
    Signed-off-by: Linus Torvalds

    Roland McGrath
     

04 Mar, 2008

12 commits


19 Feb, 2008

9 commits

  • Clear drain buffer before chaining if the command in question is a
    write.

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

    Tejun Heo
     
  • Draining shouldn't be done for commands where overflow may indicate
    data integrity issues. Add dma_drain_needed callback to
    request_queue. Drain buffer is appened iff this function returns
    non-zero.

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

    Tejun Heo
     
  • With padding and draining moved into it, block layer now may extend
    requests as directed by queue parameters, so now a request has two
    sizes - the original request size and the extended size which matches
    the size of area pointed to by bios and later by sgs. The latter size
    is what lower layers are primarily interested in when allocating,
    filling up DMA tables and setting up the controller.

    Both padding and draining extend the data area to accomodate
    controller characteristics. As any controller which speaks SCSI can
    handle underflows, feeding larger data area is safe.

    So, this patch makes the primary data length field, request->data_len,
    indicate the size of full data area and add a separate length field,
    request->raw_data_len, for the unmodified request size. The latter is
    used to report to higher layer (userland) and where the original
    request size should be fed to the controller or device.

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

    Tejun Heo
     
  • DMA start address and transfer size alignment for PC requests are
    achieved using bio_copy_user() instead of bio_map_user(). This works
    because bio_copy_user() always uses full pages and block DMA alignment
    isn't allowed to go over PAGE_SIZE.

    However, the implementation didn't update the last bio of the request
    to make this padding visible to lower layers. This patch makes
    blk_rq_map_user() extend the last bio such that it includes the
    padding area and the size of area pointed to by the request is
    properly aligned.

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

    Tejun Heo
     
  • Currently we fail if someone requests a valid io scheduler, but it's
    modular and not currently loaded. That can happen from a driver init
    asking for a different scheduler, or online switching through sysfs
    as requested by a user.

    This patch makes elevator_get() request_module() to attempt to load
    the appropriate module, instead of requiring that done manually.

    Signed-off-by: Jens Axboe

    Jens Axboe
     
  • It's cumbersome to browse a radix tree from start to finish, especially
    since we modify keys when a process exits. So add a hlist for the single
    purpose of browsing over all known cfq_io_contexts, used for exit,
    io prio change, etc.

    This fixes http://bugzilla.kernel.org/show_bug.cgi?id=9948

    Signed-off-by: Jens Axboe

    Jens Axboe
     
  • That way the interface is symmetric, and calling blk_rq_unmap_user()
    on the request wont oops.

    Signed-off-by: Jens Axboe

    Jens Axboe
     
  • blk_settings_init() can become static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Jens Axboe

    Adrian Bunk
     
  • blk_ioc_init() can become static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Jens Axboe

    Adrian Bunk