24 Jul, 2011

1 commit

  • For a number of file systems that don't have a mount point (e.g. sockfs
    and pipefs), they are not marked as long term. Therefore in
    mntput_no_expire, all locks in vfs_mount lock are taken instead of just
    local cpu's lock to aggregate reference counts when we release
    reference to file objects. In fact, only local lock need to have been
    taken to update ref counts as these file systems are in no danger of
    going away until we are ready to unregister them.

    The attached patch marks file systems using kern_mount without
    mount point as long term. The contentions of vfs_mount lock
    is now eliminated. Before un-registering such file system,
    kern_unmount should be called to remove the long term flag and
    make the mount point ready to be freed.

    Signed-off-by: Tim Chen
    Signed-off-by: Al Viro

    Tim Chen
     

25 May, 2011

2 commits

  • Now that none of the drivers use CONFIG_MTD_PARTITIONS we can remove
    it from Kconfig and the last remaining uses.

    Signed-off-by: Jamie Iles
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Jamie Iles
     
  • Replace direct call to kmalloc for a potentially large, contiguous
    buffer allocation with one to mtd_kmalloc_up_to which helps ensure the
    operation can succeed under low-memory, highly- fragmented situations
    albeit somewhat more slowly.

    Signed-off-by: Grant Erickson
    Tested-by: Ben Gardiner
    Tested-by: Stefano Babic
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Grant Erickson
     

31 Mar, 2011

1 commit


18 Jan, 2011

1 commit

  • * git://git.infradead.org/mtd-2.6: (59 commits)
    mtd: mtdpart: disallow reading OOB past the end of the partition
    mtd: pxa3xx_nand: NULL dereference in pxa3xx_nand_probe
    UBI: use mtd->writebufsize to set minimal I/O unit size
    mtd: initialize writebufsize in the MTD object of a partition
    mtd: onenand: add mtd->writebufsize initialization
    mtd: nand: add mtd->writebufsize initialization
    mtd: cfi: add writebufsize initialization
    mtd: add writebufsize field to mtd_info struct
    mtd: OneNAND: OMAP2/3: prevent regulator sleeping while OneNAND is in use
    mtd: OneNAND: add enable / disable methods to onenand_chip
    mtd: m25p80: Fix JEDEC ID for AT26DF321
    mtd: txx9ndfmc: limit transfer bytes to 512 (ECC provides 6 bytes max)
    mtd: cfi_cmdset_0002: add support for Samsung K8D3x16UxC NOR chips
    mtd: cfi_cmdset_0002: add support for Samsung K8D6x16UxM NOR chips
    mtd: nand: ams-delta: drop omap_read/write, use ioremap
    mtd: m25p80: add debugging trace in sst_write
    mtd: nand: ams-delta: select for built-in by default
    mtd: OneNAND: lighten scary initial bad block messages
    mtd: OneNAND: OMAP2/3: add support for command line partitioning
    mtd: nand: rearrange ONFI revision checking, add ONFI 2.3
    ...

    Fix up trivial conflict in drivers/mtd/Kconfig as per DavidW.

    Linus Torvalds
     

17 Jan, 2011

1 commit

  • Instead of splitting refcount between (per-cpu) mnt_count
    and (SMP-only) mnt_longrefs, make all references contribute
    to mnt_count again and keep track of how many are longterm
    ones.

    Accounting rules for longterm count:
    * 1 for each fs_struct.root.mnt
    * 1 for each fs_struct.pwd.mnt
    * 1 for having non-NULL ->mnt_ns
    * decrement to 0 happens only under vfsmount lock exclusive

    That allows nice common case for mntput() - since we can't drop the
    final reference until after mnt_longterm has reached 0 due to the rules
    above, mntput() can grab vfsmount lock shared and check mnt_longterm.
    If it turns out to be non-zero (which is the common case), we know
    that this is not the final mntput() and can just blindly decrement
    percpu mnt_count. Otherwise we grab vfsmount lock exclusive and
    do usual decrement-and-check of percpu mnt_count.

    For fs_struct.c we have mnt_make_longterm() and mnt_make_shortterm();
    namespace.c uses the latter in places where we don't already hold
    vfsmount lock exclusive and opencodes a few remaining spots where
    we need to manipulate mnt_longterm.

    Note that we mostly revert the code outside of fs/namespace.c back
    to what we used to have; in particular, normal code doesn't need
    to care about two kinds of references, etc. And we get to keep
    the optimization Nick's variant had bought us...

    Signed-off-by: Al Viro

    Al Viro
     

13 Jan, 2011

1 commit


07 Jan, 2011

1 commit

  • The problem that this patch aims to fix is vfsmount refcounting scalability.
    We need to take a reference on the vfsmount for every successful path lookup,
    which often go to the same mount point.

    The fundamental difficulty is that a "simple" reference count can never be made
    scalable, because any time a reference is dropped, we must check whether that
    was the last reference. To do that requires communication with all other CPUs
    that may have taken a reference count.

    We can make refcounts more scalable in a couple of ways, involving keeping
    distributed counters, and checking for the global-zero condition less
    frequently.

    - check the global sum once every interval (this will delay zero detection
    for some interval, so it's probably a showstopper for vfsmounts).

    - keep a local count and only taking the global sum when local reaches 0 (this
    is difficult for vfsmounts, because we can't hold preempt off for the life of
    a reference, so a counter would need to be per-thread or tied strongly to a
    particular CPU which requires more locking).

    - keep a local difference of increments and decrements, which allows us to sum
    the total difference and hence find the refcount when summing all CPUs. Then,
    keep a single integer "long" refcount for slow and long lasting references,
    and only take the global sum of local counters when the long refcount is 0.

    This last scheme is what I implemented here. Attached mounts and process root
    and working directory references are "long" references, and everything else is
    a short reference.

    This allows scalable vfsmount references during path walking over mounted
    subtrees and unattached (lazy umounted) mounts with processes still running
    in them.

    This results in one fewer atomic op in the fastpath: mntget is now just a
    per-CPU inc, rather than an atomic inc; and mntput just requires a spinlock
    and non-atomic decrement in the common case. However code is otherwise bigger
    and heavier, so single threaded performance is basically a wash.

    Signed-off-by: Nick Piggin

    Nick Piggin
     

04 Dec, 2010

2 commits

  • Function mtd_has_master renamed as mtd_is_partition to follow the function logic.
    The patch fixes the problem of checking the right mtd device for partition creation.
    To delete partition checking is not needed here so as it is done in mtd_del_partition.
    By master we consider the mtd device which does not belong to any partition.

    Signed-off-by: Roman Tereshonkov
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Roman Tereshonkov
     
  • Structure mtd_info_user is copied to userland with padding byted
    between "type" and "flags" fields uninitialized. It leads to leaking
    of contents of kernel stack memory.

    Signed-off-by: Vasiliy Kulikov
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Vasiliy Kulikov
     

30 Oct, 2010

2 commits

  • * git://git.infradead.org/mtd-2.6: (82 commits)
    mtd: fix build error in m25p80.c
    mtd: Remove redundant mutex from mtd_blkdevs.c
    MTD: Fix wrong check register_blkdev return value
    Revert "mtd: cleanup Kconfig dependencies"
    mtd: cfi_cmdset_0002: make sector erase command variable
    mtd: cfi_cmdset_0002: add CFI detection for SST 38VF640x chips
    mtd: cfi_util: add support for switching SST 39VF640xB chips into QRY mode
    mtd: cfi_cmdset_0001: use defined value of P_ID_INTEL_PERFORMANCE instead of hardcoded one
    block2mtd: dubious assignment
    P4080/mtd: Fix the freescale lbc issue with 36bit mode
    P4080/eLBC: Make Freescale elbc interrupt common to elbc devices
    mtd: phram: use KBUILD_MODNAME
    mtd: OneNAND: S5PC110: Fix double call suspend & resume function
    mtd: nand: fix MTD_MODE_RAW writes
    jffs2: use kmemdup
    mtd: sm_ftl: cosmetic, use bool when possible
    mtd: r852: remove useless pci powerup/down from suspend/resume routines
    mtd: blktrans: fix a race vs kthread_stop
    mtd: blktrans: kill BKL
    mtd: allow to unload the mtdtrans module if its block devices aren't open
    ...

    Fix up trivial whitespace-introduced conflict in drivers/mtd/mtdchar.c

    Linus Torvalds
     
  • Conflicts:
    drivers/mtd/mtd_blkdevs.c

    Merge Grant's device-tree bits so that we can apply the subsequent fixes.

    Signed-off-by: David Woodhouse

    David Woodhouse
     

29 Oct, 2010

1 commit


25 Oct, 2010

4 commits

  • Add support for mtd repartition based on the block
    device BLKPG interface:
    BLKPG_ADD_PARTITION - for partition creation;
    BLKPG_DEL_PARTITION - for partition delete

    The usage is based on BLKPG ioctl called with
    struct blkpg_ioctl_arg argument which includes the
    reference to struct blkpg_partition discribing the
    partition offset and length.

    Disadvantage: there is no implementation for mtd
    flags control. The flags are always borrowed from
    the master device.

    Signed-off-by: Roman Tereshonkov
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Roman Tereshonkov
     
  • If "ur_idx" is wrong we could go past the end of the array. The
    "ur_idx" comes from root so it's not a huge deal, but adding a sanity
    check makes the code more robust.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Dan Carpenter
     
  • There were some improvements and additions necessary in the
    comments explaining of the expansion of nand_ecclayout, the
    introduction of nand_ecclayout_user, and the deprecation of the
    ioctl ECCGETLAYOUT.

    Also, I found a better placement for the macro MTD_MAX_ECCPOS_ENTRIES;
    next to the definition of MTD_MAX_OOBFREE_ENTRIES in mtd-abi.h. The macro
    is really only important for the ioctl code (found in drivers/mtd/mtdchar.c)
    but since there are small edits being made to the user-space header, I
    figured this is a better location.

    Signed-off-by: Brian Norris
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Brian Norris
     
  • struct nand_ecclayout is too small for many new chips; OOB regions can be as
    large as 448 bytes and may increase more in the future. Thus, copying that
    struct to user-space with the ECCGETLAYOUT ioctl is not a good idea; the ioctl
    would have to be updated every time there's a change to the current largest
    size.

    Instead, the old nand_ecclayout is renamed to nand_ecclayout_user and a
    new struct nand_ecclayout is created that can accomodate larger sizes and
    expand without affecting the user-space. struct nand_ecclayout can still
    be used in board drivers without modification -- at least for now.

    A new function is provided to convert from the new to the old in order to
    allow the deprecated ioctl to continue to work with truncated data. Perhaps
    the ioctl, the conversion process, and the struct nand_ecclayout_user can be
    removed altogether in the future.

    Note: There are comments in nand/davinci_nand.c::nand_davinci_probe()
    regarding this issue; this driver (and maybe others) can be updated to
    account for extra space. All kernel drivers can use the expanded
    nand_ecclayout as a drop-in replacement and ignore its benefits.

    Signed-off-by: Brian Norris
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Brian Norris
     

16 Sep, 2010

1 commit

  • All these files use the big kernel lock in a trivial
    way to serialize their private file operations,
    typically resulting from an earlier semi-automatic
    pushdown from VFS.

    None of these drivers appears to want to lock against
    other code, and they all use the BKL as the top-level
    lock in their file operations, meaning that there
    is no lock-order inversion problem.

    Consequently, we can remove the BKL completely,
    replacing it with a per-file mutex in every case.
    Using a scripted approach means we can avoid
    typos.

    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
    Cc: David Woodhouse
    Cc: linux-mtd@lists.infradead.org

    Arnd Bergmann
     

11 Aug, 2010

1 commit

  • * git://git.infradead.org/mtd-2.6: (79 commits)
    mtd: Remove obsolete include
    mtd: Update copyright notices
    jffs2: Update copyright notices
    mtd-physmap: add support users can assign the probe type in board files
    mtd: remove redwood map driver
    mxc_nand: Add v3 (i.MX51) Support
    mxc_nand: support 8bit ecc
    mxc_nand: fix correct_data function
    mxc_nand: add V1_V2 namespace to registers
    mxc_nand: factor out a check_int function
    mxc_nand: make some internally used functions overwriteable
    mxc_nand: rework get_dev_status
    mxc_nand: remove 0xe00 offset from registers
    mtd: denali: Add multi connected NAND support
    mtd: denali: Remove set_ecc_config function
    mtd: denali: Remove unuseful code in get_xx_nand_para functions
    mtd: denali: Remove device_info_tag structure
    mtd: m25p80: add support for the Winbond W25Q32 SPI flash chip
    mtd: m25p80: add support for the Intel/Numonyx {16,32,64}0S33B SPI flash chips
    mtd: m25p80: add support for the EON EN25P{32, 64} SPI flash chips
    ...

    Fix up trivial conflicts in drivers/mtd/maps/{Kconfig,redwood.c} due to
    redwood driver removal.

    Linus Torvalds
     

09 Aug, 2010

2 commits


04 Aug, 2010

1 commit

  • For no-mmu systems mmap() on RAM/ROM devices already works
    but for systems with mmu it probably was not tested and
    doesn't work.

    This patch allows using mmap() on MTD RAM/ROM devices on systems
    with MMU. It has been tested on mpc5121e based platform with
    MR0A16A MRAM device attached over LocalBus.

    Signed-off-by: Anatolij Gustschin
    Acked-by: Mike Frysinger
    Signed-off-by: David Woodhouse

    Anatolij Gustschin
     

02 Aug, 2010

1 commit


08 Jun, 2010

1 commit

  • * git://git.infradead.org/~dwmw2/mtd-2.6.35:
    jffs2: update ctime when changing the file's permission by setfacl
    jffs2: Fix NFS race by using insert_inode_locked()
    jffs2: Fix in-core inode leaks on error paths
    mtd: Fix NAND submenu
    mtd/r852: update card detect early.
    mtd/r852: Fixes in case of DMA timeout
    mtd/r852: register IRQ as last step
    drivers/mtd: Use memdup_user
    docbook: make mtd nand module init static

    Linus Torvalds
     

24 May, 2010

1 commit

  • * 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
    uml: Pushdown the bkl from harddog_kern ioctl
    sunrpc: Pushdown the bkl from sunrpc cache ioctl
    sunrpc: Pushdown the bkl from ioctl
    autofs4: Pushdown the bkl from ioctl
    uml: Convert to unlocked_ioctls to remove implicit BKL
    ncpfs: BKL ioctl pushdown
    coda: Clean-up whitespace problems in pioctl.c
    coda: BKL ioctl pushdown
    drivers: Push down BKL into various drivers
    isdn: Push down BKL into ioctl functions
    scsi: Push down BKL into ioctl functions
    dvb: Push down BKL into ioctl functions
    smbfs: Push down BKL into ioctl function
    coda/psdev: Remove BKL from ioctl function
    um/mmapper: Remove BKL usage
    sn_hwperf: Kill BKL usage
    hfsplus: Push down BKL into ioctl function

    Linus Torvalds
     

22 May, 2010

1 commit

  • Use memdup_user when user data is immediately copied into the
    allocated region.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    expression from,to,size,flag;
    position p;
    identifier l1,l2;
    @@

    - to = \(kmalloc@p\|kzalloc@p\)(size,flag);
    + to = memdup_user(from,size);
    if (
    - to==NULL
    + IS_ERR(to)
    || ...) {

    }
    - if (copy_from_user(to, from, size) != 0) {
    -
    - }
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: David Woodhouse

    Julia Lawall
     

18 May, 2010

1 commit

  • We cannot modify file->f_mapping->backing_dev_info, because it will corrupt
    backing device of device node inode, since file->f_mapping is equal to
    inode->i_mapping (see __dentry_open() in fs/open.c).

    Let's introduce separate inode for MTD device with appropriate backing
    device.

    [dwmw2: Refactor to keep it all entirely within mtdchar.c; use iget_locked()]

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Jan Kara
    Signed-off-by: David Woodhouse

    Kirill A. Shutemov
     

17 May, 2010

1 commit

  • These are the last remaining device drivers using
    the ->ioctl file operation in the drivers directory
    (except from v4l drivers).

    [fweisbec: drop i8k pushdown as it has been done from
    procfs pushdown branch already]

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Frederic Weisbecker

    Arnd Bergmann
     

25 Feb, 2010

4 commits


29 May, 2009

5 commits


04 Apr, 2009

1 commit

  • Update driver model support in the MTD framework, so it fits
    better into the current udev-based hotplug framework:

    - Each mtd_info now has a device node. MTD drivers should set
    the dev.parent field to point to the physical device, before
    setting up partitions or otherwise declaring MTDs.

    - Those device nodes always map to /sys/class/mtdX device nodes,
    which no longer depend on MTD_CHARDEV.

    - Those mtdX sysfs nodes have a "starter set" of attributes;
    it's not yet sufficient to replace /proc/mtd.

    - Enabling MTD_CHARDEV provides /sys/class/mtdXro/ nodes and the
    /sys/class/mtd*/dev attributes (for udev, mdev, etc).

    - Include a MODULE_ALIAS_CHARDEV_MAJOR macro. It'll work with
    udev creating the /dev/mtd* nodes, not just a static rootfs.

    So the sysfs structure is pretty much what you'd expect, except
    that readonly chardev nodes are a bit quirky.

    Signed-off-by: David Brownell
    Signed-off-by: David Woodhouse

    David Brownell
     

24 Mar, 2009

1 commit


21 Mar, 2009

1 commit