1. 06 1月, 2009 14 次提交
    • M
      dm: add name and uuid to sysfs · 784aae73
      Milan Broz 提交于
      Implement simple read-only sysfs entry for device-mapper block device.
      
      This patch adds a simple sysfs directory named "dm" under block device
      properties and implements
      	- name attribute (string containing mapped device name)
      	- uuid attribute (string containing UUID, or empty string if not set)
      
      The kobject is embedded in mapped_device struct, so no additional
      memory allocation is needed for initializing sysfs entry.
      
      During the processing of sysfs attribute we need to lock mapped device
      which is done by a new function dm_get_from_kobj, which returns the md
      associated with kobject and increases the usage count.
      
      Each 'show attribute' function is responsible for its own locking.
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      784aae73
    • M
      dm table: rework reference counting · d5816876
      Mikulas Patocka 提交于
      Rework table reference counting.
      
      The existing code uses a reference counter. When the last reference is
      dropped and the counter reaches zero, the table destructor is called.
      Table reference counters are acquired/released from upcalls from other
      kernel code (dm_any_congested, dm_merge_bvec, dm_unplug_all).
      If the reference counter reaches zero in one of the upcalls, the table
      destructor is called from almost random kernel code.
      
      This leads to various problems:
      * dm_any_congested being called under a spinlock, which calls the
        destructor, which calls some sleeping function.
      * the destructor attempting to take a lock that is already taken by the
        same process.
      * stale reference from some other kernel code keeps the table
        constructed, which keeps some devices open, even after successful
        return from "dmsetup remove". This can confuse lvm and prevent closing
        of underlying devices or reusing device minor numbers.
      
      The patch changes reference counting so that the table destructor can be
      called only at predetermined places.
      
      The table has always exactly one reference from either mapped_device->map
      or hash_cell->new_map. After this patch, this reference is not counted
      in table->holders.  A pair of dm_create_table/dm_destroy_table functions
      is used for table creation/destruction.
      
      Temporary references from the other code increase table->holders. A pair
      of dm_table_get/dm_table_put functions is used to manipulate it.
      
      When the table is about to be destroyed, we wait for table->holders to
      reach 0. Then, we call the table destructor.  We use active waiting with
      msleep(1), because the situation happens rarely (to one user in 5 years)
      and removing the device isn't performance-critical task: the user doesn't
      care if it takes one tick more or not.
      
      This way, the destructor is called only at specific points
      (dm_table_destroy function) and the above problems associated with lazy
      destruction can't happen.
      
      Finally remove the temporary protection added to dm_any_congested().
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      d5816876
    • A
      dm: support barriers on simple devices · ab4c1424
      Andi Kleen 提交于
      Implement barrier support for single device DM devices
      
      This patch implements barrier support in DM for the common case of dm linear
      just remapping a single underlying device. In this case we can safely
      pass the barrier through because there can be no reordering between
      devices.
      
       NB. Any DM device might cease to support barriers if it gets
           reconfigured so code must continue to allow for a possible
           -EOPNOTSUPP on every barrier bio submitted.  - agk
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      ab4c1424
    • K
      dm request: extend target interface · 7d76345d
      Kiyoshi Ueda 提交于
      This patch adds the following target interfaces for request-based dm.
      
        map_rq    : for mapping a request
      
        rq_end_io : for finishing a request
      
        busy      : for avoiding performance regression from bio-based dm.
                    Target can tell dm core not to map requests now, and
                    that may help requests in the block layer queue to be
                    bigger by I/O merging.
                    In bio-based dm, this behavior is done by device
                    drivers managing the block layer queue.
                    But in request-based dm, dm core has to do that
                    since dm core manages the block layer queue.
      Signed-off-by: NKiyoshi Ueda <k-ueda@ct.jp.nec.com>
      Signed-off-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      7d76345d
    • K
      dm request: add caches · 8fbf26ad
      Kiyoshi Ueda 提交于
      This patch prepares some kmem_caches for request-based dm.
      Signed-off-by: NKiyoshi Ueda <k-ueda@ct.jp.nec.com>
      Signed-off-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      8fbf26ad
    • M
      dm ioctl: allow dm_copy_name_and_uuid to return only one field · 23d39f63
      Milan Broz 提交于
      Allow NULL buffer in dm_copy_name_and_uuid if you only want to return one of
      the fields.
      
      (Required by a following patch that adds these fields to sysfs.)
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Reviewed-by: NAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      23d39f63
    • M
      dm log: ensure log bitmap fits on log device · ac1f0ac2
      Milan Broz 提交于
      Check that the log bitmap will fit within the log device.
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      ac1f0ac2
    • M
      dm log: move region_size validation · 2045e88e
      Milan Broz 提交于
      Move log size validation from mirror target to log constructor.
      
      Removed PAGE_SIZE restriction we no longer think necessary.
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      2045e88e
    • T
      dm log: avoid reinitialising io_req on every operation · 6f3af01c
      Takahiro Yasui 提交于
      rw_header function updates three members of io_req data every time
      when I/O is processed. bi_rw and notify.fn are never modified once
      they get initialized, and so they can be set in advance.
      
      header_to_disk() can also be pulled out of write_header() since only one
      caller needs it and write_header() can be replaced by rw_header()
      directly.
      Signed-off-by: NTakahiro Yasui <tyasui@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      6f3af01c
    • M
      dm: consolidate target deregistration error handling · 10d3bd09
      Mikulas Patocka 提交于
      Change dm_unregister_target to return void and use BUG() for error
      reporting.
      
      dm_unregister_target can only fail because of programming bug in the
      target driver. It can't fail because of user's behavior or disk errors.
      
      This patch changes unregister_target to return void and use BUG if
      someone tries to unregister non-registered target or unregister target
      that is in use.
      
      This patch removes code duplication (testing of error codes in all dm
      targets) and reports bugs in just one place, in dm_unregister_target. In
      some target drivers, these return codes were ignored, which could lead
      to a situation where bugs could be missed.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      10d3bd09
    • J
      dm raid1: fix error count · d460c65a
      Jonathan Brassow 提交于
      Always increase the error count when I/O on a leg of a mirror fails.
      
      The error count is used to decide whether to select an alternative
      mirror leg.  If the target doesn't use the "handle_errors" feature, the
      error count is not updated and the bio can get requeued forever by the
      read callback.
      
      Fix it by increasing error_count before the handle_errors feature
      checking.
      
      Cc: stable@kernel.org
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      d460c65a
    • T
      dm log: fix dm_io_client leak on error paths · c7a2bd19
      Takahiro Yasui 提交于
      In create_log_context function, dm_io_client_destroy function needs
      to be called, when memory allocation of disk_header, sync_bits and
      recovering_bits failed, but dm_io_client_destroy is not called.
      
      Cc: stable@kernel.org
      Signed-off-by: NTakahiro Yasui <tyasui@redhat.com>
      Acked-by: NJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      c7a2bd19
    • M
      dm snapshot: change yield to msleep · 90fa1527
      Mikulas Patocka 提交于
      Change yield() to msleep(1). If the thread had realtime priority,
      yield() doesn't really yield, so the yielding process would loop
      indefinitely and cause machine lockup.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      90fa1527
    • M
      dm table: drop reference at unbind · a1b51e98
      Mikulas Patocka 提交于
      Move one dm_table_put() so that the last reference in the thread
      gets dropped in __unbind().
      
      This is required for a following patch,
      dm-table-rework-reference-counting.patch, which will change the logic in
      such a way that table destructor is called only at specific points in
      the code.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      a1b51e98
  2. 05 1月, 2009 24 次提交
  3. 04 1月, 2009 2 次提交
    • L
      Merge branch 'cpus4096-for-linus-3' of... · 7d3b56ba
      Linus Torvalds 提交于
      Merge branch 'cpus4096-for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
      
      * 'cpus4096-for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (77 commits)
        x86: setup_per_cpu_areas() cleanup
        cpumask: fix compile error when CONFIG_NR_CPUS is not defined
        cpumask: use alloc_cpumask_var_node where appropriate
        cpumask: convert shared_cpu_map in acpi_processor* structs to cpumask_var_t
        x86: use cpumask_var_t in acpi/boot.c
        x86: cleanup some remaining usages of NR_CPUS where s/b nr_cpu_ids
        sched: put back some stack hog changes that were undone in kernel/sched.c
        x86: enable cpus display of kernel_max and offlined cpus
        ia64: cpumask fix for is_affinity_mask_valid()
        cpumask: convert RCU implementations, fix
        xtensa: define __fls
        mn10300: define __fls
        m32r: define __fls
        h8300: define __fls
        frv: define __fls
        cris: define __fls
        cpumask: CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
        cpumask: zero extra bits in alloc_cpumask_var_node
        cpumask: replace for_each_cpu_mask_nr with for_each_cpu in kernel/time/
        cpumask: convert mm/
        ...
      7d3b56ba
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu · 269b0123
      Linus Torvalds 提交于
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu: (89 commits)
        AMD IOMMU: remove now unnecessary #ifdefs
        AMD IOMMU: prealloc_protection_domains should be static
        kvm/iommu: fix compile warning
        AMD IOMMU: add statistics about total number of map requests
        AMD IOMMU: add statistics about allocated io memory
        AMD IOMMU: add stats counter for domain tlb flushes
        AMD IOMMU: add stats counter for single iommu domain tlb flushes
        AMD IOMMU: add stats counter for cross-page request
        AMD IOMMU: add stats counter for free_coherent requests
        AMD IOMMU: add stats counter for alloc_coherent requests
        AMD IOMMU: add stats counter for unmap_sg requests
        AMD IOMMU: add stats counter for map_sg requests
        AMD IOMMU: add stats counter for unmap_single requests
        AMD IOMMU: add stats counter for map_single requests
        AMD IOMMU: add stats counter for completion wait events
        AMD IOMMU: add init code for statistic collection
        AMD IOMMU: add necessary header defines for stats counting
        AMD IOMMU: add Kconfig entry for statistic collection code
        AMD IOMMU: use dev_name in iommu_enable function
        AMD IOMMU: use calc_devid in prealloc_protection_domains
        ...
      269b0123