05 Jun, 2014

1 commit

  • Description by Jan Kara:
    "A lot of older filesystems don't properly flush volatile disk caches
    on fsync(2) which can lead to loss of fsynced data after power failure.

    This patch makes generic_file_fsync() issue proper cache flush to fix the
    problem. Sysadmin can use /sys/devices/.../cache_type to tell the system
    it should not send the cache flush."

    [akpm@linux-foundation.org: nuke ifdef]
    [akpm@linux-foundation.org: fix warning]
    Signed-off-by: Fabian Frederick
    Suggested-by: Jan Kara
    Suggested-by: Christoph Hellwig
    Cc: Jan Kara
    Cc: Christoph Hellwig
    Cc: Alexander Viro
    Cc: "Theodore Ts'o"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     

16 Nov, 2013

1 commit


09 Nov, 2013

1 commit


25 Oct, 2013

2 commits


14 Jul, 2013

1 commit


29 Jun, 2013

1 commit


21 Dec, 2012

1 commit


18 Dec, 2012

1 commit


05 Sep, 2012

1 commit


14 Jul, 2012

2 commits

  • Pass mount flags to sget() so that it can use them in initialising a new
    superblock before the set function is called. They could also be passed to the
    compare function.

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     
  • Just the flags; only NFS cares even about that, but there are
    legitimate uses for such argument. And getting rid of that
    completely would require splitting ->lookup() into a couple
    of methods (at least), so let's leave that alone for now...

    Signed-off-by: Al Viro

    Al Viro
     

11 May, 2012

1 commit

  • This allows comparing hash and len in one operation on 64-bit
    architectures. Right now only __d_lookup_rcu() takes advantage of this,
    since that is the case we care most about.

    The use of anonymous struct/unions hides the alternate 64-bit approach
    from most users, the exception being a few cases where we initialize a
    'struct qstr' with a static initializer. This makes the problematic
    cases use a new QSTR_INIT() helper function for that (but initializing
    just the name pointer with a "{ .name = xyzzy }" initializer remains
    valid, as does just copying another qstr structure).

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

09 Apr, 2012

1 commit

  • d_genocide() does _not_ evict dentries; it just removes extra ref
    pinning each of those. Normally it's followed by shrinking the
    tree (it's done just before generic_shutdown_super() by kill_litter_super()),
    but in case of simple_fill_super() nothing of that kind will follow.
    Just do shrink_dcache_parent() manually.

    Signed-off-by: Al Viro

    Al Viro
     

06 Apr, 2012

1 commit

  • debugfs and a few other drivers use an open-coded version of
    simple_open() to pass a pointer from the file to the read/write file
    ops. Add support for this simple case to libfs so that we can remove
    the many duplicate copies of this simple function.

    Signed-off-by: Stephen Boyd
    Cc: Al Viro
    Cc: Julia Lawall
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     

25 Mar, 2012

1 commit

  • Pull cleanup of fs/ and lib/ users of module.h from Paul Gortmaker:
    "Fix up files in fs/ and lib/ dirs to only use module.h if they really
    need it.

    These are trivial in scope vs the work done previously. We now have
    things where any few remaining cleanups can be farmed out to arch or
    subsystem maintainers, and I have done so when possible. What is
    remaining here represents the bits that don't clearly lie within a
    single arch/subsystem boundary, like the fs dir and the lib dir.

    Some duplicate includes arising from overlapping fixes from
    independent subsystem maintainer submissions are also quashed."

    Fix up trivial conflicts due to clashes with other include file cleanups
    (including some due to the previous bug.h cleanup pull).

    * tag 'module-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux:
    lib: reduce the use of module.h wherever possible
    fs: reduce the use of module.h wherever possible
    includecheck: delete any duplicate instances of module.h

    Linus Torvalds
     

21 Mar, 2012

2 commits


29 Feb, 2012

1 commit


04 Jan, 2012

1 commit

  • Move invalidate_bdev, block_sync_page into fs/block_dev.c. Export
    kill_bdev as well, so brd doesn't have to open code it. Reduce
    buffer_head.h requirement accordingly.

    Removed a rather large comment from invalidate_bdev, as it looked a bit
    obsolete to bother moving. The small comment replacing it says enough.

    Signed-off-by: Nick Piggin
    Cc: Al Viro
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Al Viro

    Al Viro
     

02 Nov, 2011

2 commits


23 Jul, 2011

1 commit


21 Jul, 2011

1 commit

  • Btrfs needs to be able to control how filemap_write_and_wait_range() is called
    in fsync to make it less of a painful operation, so push down taking i_mutex and
    the calling of filemap_write_and_wait() down into the ->fsync() handlers. Some
    file systems can drop taking the i_mutex altogether it seems, like ext3 and
    ocfs2. For correctness sake I just pushed everything down in all cases to make
    sure that we keep the current behavior the same for everybody, and then each
    individual fs maintainer can make up their mind about what to do from there.
    Thanks,

    Acked-by: Jan Kara
    Signed-off-by: Josef Bacik
    Signed-off-by: Al Viro

    Josef Bacik
     

20 Jul, 2011

2 commits

  • New helper (non-exported, fs/internal.h-only): __d_alloc(sb, name).
    Allocates dentry, sets its ->d_sb to given superblock and sets
    ->d_op accordingly. Old d_alloc(NULL, name) callers are converted
    to that (all of them know what superblock they want). d_alloc()
    itself is left only for parent != NULl case; uses __d_alloc(),
    inserts result into the list of parent's children.

    Note that now ->d_sb is assign-once and never NULL *and*
    ->d_parent is never NULL either.

    Signed-off-by: Al Viro

    Al Viro
     
  • Assume that /sys/kernel/debug/dummy64 is debugfs file created by
    debugfs_create_x64().

    # cd /sys/kernel/debug
    # echo 0x1234567812345678 > dummy64
    # cat dummy64
    0x0000000012345678

    # echo 0x80000000 > dummy64
    # cat dummy64
    0xffffffff80000000

    A value larger than INT_MAX cannot be written to the debugfs file created
    by debugfs_create_u64 or debugfs_create_x64 on 32bit machine. Because
    simple_attr_write() uses simple_strtol() for the conversion.

    To fix this, use simple_strtoll() instead.

    Signed-off-by: Akinobu Mita
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

13 Jan, 2011

1 commit


07 Jan, 2011

5 commits

  • Reduce some branches and memory accesses in dcache lookup by adding dentry
    flags to indicate common d_ops are set, rather than having to check them.
    This saves a pointer memory access (dentry->d_op) in common path lookup
    situations, and saves another pointer load and branch in cases where we
    have d_op but not the particular operation.

    Patched with:

    git grep -E '[.>]([[:space:]])*d_op([[:space:]])*=' | xargs sed -e 's/\([^\t ]*\)->d_op = \(.*\);/d_set_d_op(\1, \2);/' -e 's/\([^\t ]*\)\.d_op = \(.*\);/d_set_d_op(\&\1, \2);/' -i

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • dcache_lock no longer protects anything. remove it.

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • Protect d_subdirs and d_child with d_lock, except in filesystems that aren't
    using dcache_lock for these anyway (eg. using i_mutex).

    Note: if we change the locking rule in future so that ->d_child protection is
    provided only with ->d_parent->d_lock, it may allow us to reduce some locking.
    But it would be an exception to an otherwise regular locking scheme, so we'd
    have to see some good results. Probably not worthwhile.

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • Protect d_unhashed(dentry) condition with d_lock. This means keeping
    DCACHE_UNHASHED bit in synch with hash manipulations.

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • Change d_delete from a dentry deletion notification to a dentry caching
    advise, more like ->drop_inode. Require it to be constant and idempotent,
    and not take d_lock. This is how all existing filesystems use the callback
    anyway.

    This makes fine grained dentry locking of dput and dentry lru scanning
    much simpler.

    Signed-off-by: Nick Piggin

    Nick Piggin
     

29 Oct, 2010

1 commit


26 Oct, 2010

2 commits

  • Clones an existing reference to inode; caller must already hold one.

    Signed-off-by: Al Viro

    Al Viro
     
  • Add a new helper to write out the inode using the writeback code,
    that is including the correct dirty bit and list manipulation. A few
    of filesystems already opencode this, and a lot of others should be
    using it instead of using write_inode_now which also writes out the
    data.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

10 Sep, 2010

2 commits

  • generic_check_addressable() erroneously shifts pages down by a block
    factor when it should be shifting up. To prevent overflow, we shift
    blocks down to pages.

    Signed-off-by: Joel Becker

    Joel Becker
     
  • As part of adding support for OCFS2 to mount huge volumes, we need to
    check that the sector_t and page cache of the system are capable of
    addressing the entire volume.

    An identical check already appears in ext3 and ext4. This patch moves
    the addressability check into its own function in fs/libfs.c and
    modifies ext3 and ext4 to invoke it.

    [Edited to -EINVAL instead of BUG_ON() for bad blocksize_bits -- Joel]

    Signed-off-by: Patrick LoPresti
    Cc: linux-ext4@vger.kernel.org
    Acked-by: Andreas Dilger
    Signed-off-by: Joel Becker

    Patrick J. LoPresti
     

10 Aug, 2010

3 commits

  • Make sure we check the truncate constraints early on in ->setattr by adding
    those checks to inode_change_ok. Also clean up and document inode_change_ok
    to make this obvious.

    As a fallout we don't have to call inode_newsize_ok from simple_setsize and
    simplify it down to a truncate_setsize which doesn't return an error. This
    simplifies a lot of setattr implementations and means we use truncate_setsize
    almost everywhere. Get rid of fat_setsize now that it's trivial and mark
    ext2_setsize static to make the calling convention obvious.

    Keep the inode_newsize_ok in vmtruncate for now as all callers need an
    audit for its removal anyway.

    Note: setattr code in ecryptfs doesn't call inode_change_ok at all and
    needs a deeper audit, but that is left for later.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • With the new truncate sequence every filesystem that wants to support file
    size changes on disk needs to implement its own ->setattr. So instead
    of calling inode_setattr which supports size changes call into a simple
    method that doesn't support this. simple_setattr is almost what we
    want except that it does not mark the inode dirty after changes. Given
    that marking the inode dirty is a no-op for the simple in-memory filesystems
    that use simple_setattr currently just add the mark_inode_dirty call.

    Also add a WARN_ON for the presence of a truncate method to simple_setattr
    to catch new instances of it during the transition period.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • Despite its name it's now a generic implementation of ->setattr, but
    rather a helper to copy attributes from a struct iattr to the inode.
    Rename it to setattr_copy to reflect this fact.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig