14 Sep, 2009

2 commits

  • When do_balance() balances the tree, a trick is performed to
    provide the ability for other tree writers/readers to check whether
    do_balance() is executing concurrently (requires CONFIG_REISERFS_CHECK).

    This is done to protect concurrent accesses to the tree. The trick
    is the following:

    When do_balance is called, a unique global variable called cur_tb
    takes a pointer to the current tree to be rebalanced.
    Once do_balance finishes its work, cur_tb takes the NULL value.

    Then, concurrent tree readers/writers just have to check the value
    of cur_tb to ensure do_balance isn't executing concurrently.
    If it is, then it proves that schedule() occured on do_balance(),
    which then relaxed the bkl that protected the tree.

    Now that the bkl has be turned into a mutex, this check is still
    fine even though do_balance() becomes preemptible: the write lock
    will not be automatically released on schedule(), so the tree is
    still protected.

    But this is only fine if we have a single reiserfs mountpoint.
    Indeed, because the bkl is a global lock, it didn't allowed
    concurrent executions between a tree reader/writer in a mount point
    and a do_balance() on another tree from another mountpoint.

    So assuming all these readers/writers weren't supposed to be
    reentrant, the current check now sometimes detect false positives with
    the current per-superblock mutex which allows this reentrancy.

    This patch keeps the concurrent tree accesses check but moves it
    per superblock, so that only trees from a same mount point are
    checked to be not accessed concurrently.

    [ Impact: fix spurious panic while running several reiserfs mount-points ]

    Cc: Jeff Mahoney
    Cc: Chris Mason
    Cc: Ingo Molnar
    Cc: Alexander Beregalov
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • This patch is an attempt to remove the Bkl based locking scheme from
    reiserfs and is intended.

    It is a bit inspired from an old attempt by Peter Zijlstra:

    http://lkml.indiana.edu/hypermail/linux/kernel/0704.2/2174.html

    The bkl is heavily used in this filesystem to prevent from
    concurrent write accesses on the filesystem.

    Reiserfs makes a deep use of the specific properties of the Bkl:

    - It can be acqquired recursively by a same task
    - It is released on the schedule() calls and reacquired when schedule() returns

    The two properties above are a roadmap for the reiserfs write locking so it's
    very hard to simply replace it with a common mutex.

    - We need a recursive-able locking unless we want to restructure several blocks
    of the code.
    - We need to identify the sites where the bkl was implictly relaxed
    (schedule, wait, sync, etc...) so that we can in turn release and
    reacquire our new lock explicitly.
    Such implicit releases of the lock are often required to let other
    resources producer/consumer do their job or we can suffer unexpected
    starvations or deadlocks.

    So the new lock that replaces the bkl here is a per superblock mutex with a
    specific property: it can be acquired recursively by a same task, like the
    bkl.

    For such purpose, we integrate a lock owner and a lock depth field on the
    superblock information structure.

    The first axis on this patch is to turn reiserfs_write_(un)lock() function
    into a wrapper to manage this mutex. Also some explicit calls to
    lock_kernel() have been converted to reiserfs_write_lock() helpers.

    The second axis is to find the important blocking sites (schedule...(),
    wait_on_buffer(), sync_dirty_buffer(), etc...) and then apply an explicit
    release of the write lock on these locations before blocking. Then we can
    safely wait for those who can give us resources or those who need some.
    Typically this is a fight between the current writer, the reiserfs workqueue
    (aka the async commiter) and the pdflush threads.

    The third axis is a consequence of the second. The write lock is usually
    on top of a lock dependency chain which can include the journal lock, the
    flush lock or the commit lock. So it's dangerous to release and trying to
    reacquire the write lock while we still hold other locks.

    This is fine with the bkl:

    T1 T2

    lock_kernel()
    mutex_lock(A)
    unlock_kernel()
    // do something
    lock_kernel()
    mutex_lock(A) -> already locked by T1
    schedule() (and then unlock_kernel())
    lock_kernel()
    mutex_unlock(A)
    ....

    This is not fine with a mutex:

    T1 T2

    mutex_lock(write)
    mutex_lock(A)
    mutex_unlock(write)
    // do something
    mutex_lock(write)
    mutex_lock(A) -> already locked by T1
    schedule()

    mutex_lock(write) -> already locked by T2
    deadlock

    The solution in this patch is to provide a helper which releases the write
    lock and sleep a bit if we can't lock a mutex that depend on it. It's another
    simulation of the bkl behaviour.

    The last axis is to locate the fs callbacks that are called with the bkl held,
    according to Documentation/filesystem/Locking.

    Those are:

    - reiserfs_remount
    - reiserfs_fill_super
    - reiserfs_put_super

    Reiserfs didn't need to explicitly lock because of the context of these callbacks.
    But now we must take care of that with the new locking.

    After this patch, reiserfs suffers from a slight performance regression (for now).
    On UP, a high volume write with dd reports an average of 27 MB/s instead
    of 30 MB/s without the patch applied.

    Signed-off-by: Frederic Weisbecker
    Reviewed-by: Ingo Molnar
    Cc: Jeff Mahoney
    Cc: Peter Zijlstra
    Cc: Bron Gondwana
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Alexander Viro
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

12 Jun, 2009

1 commit


09 May, 2009

2 commits

  • With Al Viro's patch to move privroot lookup to fs mount, there's no need
    to have special code to hide the privroot in reiserfs_lookup.

    I've also cleaned up the privroot hiding in reiserfs_readdir_dentry and
    removed the last user of reiserfs_xattrs().

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Al Viro

    Jeff Mahoney
     
  • The xattr_root caching was broken from my previous patch set. It wouldn't
    cause corruption, but could cause decreased performance due to allocating
    a larger chunk of the journal (~ 27 blocks) than it would actually use.

    This patch loads the xattr root dentry at xattr initialization and creates
    it on-demand. Since we're using the cached dentry, there's no point
    in keeping lookup_or_create_dir around, so that's removed.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Al Viro

    Jeff Mahoney
     

21 Apr, 2009

1 commit


31 Mar, 2009

6 commits

  • This patch strips trailing whitespace from the reiserfs code.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • Christoph Hellwig had asked me quite some time ago to port the reiserfs
    xattrs to the generic xattr interface.

    This patch replaces the reiserfs-specific xattr handling code with the
    generic struct xattr_handler.

    However, since reiserfs doesn't split the prefix and name when accessing
    xattrs, it can't leverage generic_{set,get,list,remove}xattr without
    needlessly reconstructing the name on the back end.

    Update 7/26/07: Added missing dput() to deletion path.
    Update 8/30/07: Added missing mark_inode_dirty when i_mode is used to
    represent an ACL and no previous ACL existed.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • With the switch to using inode->i_mutex locking during lookups/creation
    in the xattr root, the per-super xattr lock is no longer needed.

    This patch removes it.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • The current reiserfs xattr implementation will not clean up old xattr
    files if files are deleted when REISERFS_FS_XATTR is unset. This
    results in inaccessible lost files, wasting space.

    This patch compiles in basic xattr knowledge, such as how to delete them
    and change ownership for quota tracking. If the file system has never
    used xattrs, then the operation is quite fast: it returns immediately
    when it sees there is no .reiserfs_priv directory.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • This patch fixes up the reiserfs code such that transaction ids are
    always unsigned ints. In places they can currently be signed ints or
    unsigned longs.

    The former just causes an annoying clm-2200 warning and may join a
    transaction when it should wait.

    The latter is just for correctness since the disk format uses a 32-bit
    transaction id. There aren't any runtime problems that result from it
    not wrapping at the correct location since the value is truncated
    correctly even on big endian systems. The 0 value might make it to
    disk, but the mount-time checks will bump it to 10 itself.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • The following patch adds the fields for tracking mount counts and last
    fsck timestamps to the superblock. It also increments the mount count
    on every read-write mount.

    Reiserfsprogs 3.6.21 added support for these fields.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     

21 Oct, 2008

1 commit


26 Jul, 2008

3 commits

  • j_commit_lock is a semaphore but uses it as if it were a mutex. This patch
    converts it to a mutex.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Jeff Mahoney
    Cc: Matthew Wilcox
    Cc: Chris Mason
    Cc: Edward Shishkin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • j_flush_sem is a semaphore but uses it as if it were a mutex. This patch
    converts it to a mutex.

    [akpm@linux-foundation.org: fix mutex_trylock retval treatment]
    Signed-off-by: Jeff Mahoney
    Cc: Matthew Wilcox
    Cc: Chris Mason
    Cc: Edward Shishkin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • j_lock is a semaphore but uses it as if it were a mutex. This patch converts
    it to a mutex.

    Signed-off-by: Jeff Mahoney
    Cc: Matthew Wilcox
    Cc: Chris Mason
    Cc: Edward Shishkin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     

30 Apr, 2008

1 commit

  • Use the proper helper to open a blockdevice by name for filesystem use,
    this makes sure it's properly claimed (also added for open-by-number) and
    gets rid of the struct file abuse.

    Tested by mounting a reiserfs filesystem with external journal.

    Signed-off-by: Christoph Hellwig
    Cc: Chris Mason
    Cc: Jeff Mahoney
    Acked-by: Edward Shishkin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     

03 Feb, 2008

1 commit


20 Oct, 2007

1 commit

  • The first_zero_hint metadata caching was never actually used, and it's of
    dubious optimization quality. This patch removes it.

    It doesn't actually shrink the size of the reiserfs_bitmap_info struct, since
    that doesn't work with block sizes larger than 8K. There was a big fixme in
    there, and with all the work lately in allowing block size > page size, I
    might as well kill the fixme as well.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     

15 Oct, 2007

1 commit


09 May, 2007

1 commit

  • This makes in-core superblock fit into one cacheline here.

    Before:
    struct dentry * xattr_root; /* 124 4 */
    /* --- cacheline 1 boundary (128 bytes) --- */
    struct rw_semaphore xattr_dir_sem; /* 128 12 */
    int j_errno; /* 140 4 */
    }; /* size: 144, cachelines: 2 */
    /* sum members: 142, holes: 1, sum holes: 2 */
    /* last cacheline: 16 bytes */

    After:
    int j_errno; /* 124 4 */
    /* --- cacheline 1 boundary (128 bytes) --- */
    }; /* size: 128, cachelines: 1 */
    /* sum members: 126, holes: 1, sum holes: 2 */

    Signed-off-by: Alexey Dobriyan
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

05 Dec, 2006

1 commit


30 Nov, 2006

1 commit


22 Nov, 2006

1 commit


01 Oct, 2006

2 commits

  • This is the patch the three previous ones have been leading up to.

    It changes the behavior of ReiserFS from loading and caching all the bitmaps
    as special, to treating the bitmaps like any other bit of metadata and just
    letting the system-wide caches figure out what to hang on to.

    Buffer heads are allocated on the fly, so there is no need to retain pointers
    to all of them. The caching of the metadata occurs when the data is read and
    updated, and is considered invalid and uncached until then.

    I needed to remove the vs-4040 check for performing a duplicate operation on a
    particular bit. The reason is that while the other sites for working with
    bitmaps are allowed to schedule, is_reusable() is called from do_balance(),
    which will panic if a schedule occurs in certain places.

    The benefit of on-demand bitmaps clearly outweighs a sanity check that depends
    on a compile-time option that is discouraged.

    [akpm@osdl.org: warning fix]
    Signed-off-by: Jeff Mahoney
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • There is a check in is_reusable to determine if a particular block is a bitmap
    block. It verifies this by going through the array of bitmap block buffer
    heads and comparing the block number to each one.

    Bitmap blocks are at defined locations on the disk in both old and current
    formats. Simply checking against the known good values is enough.

    This is a trivial optimization for a non-production codepath, but this is the
    first in a series of patches that will ultimately remove the buffer heads from
    that array.

    Signed-off-by: Jeff Mahoney
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     

02 Feb, 2006

1 commit


13 Jul, 2005

1 commit

  • This was a pure indentation change, using:

    scripts/Lindent fs/reiserfs/*.c include/linux/reiserfs_*.h

    to make reiserfs match the regular Linux indentation style. As Jeff
    Mahoney writes:

    The ReiserFS code is a mix of a number of different coding styles, sometimes
    different even from line-to-line. Since the code has been relatively stable
    for quite some time and there are few outstanding patches to be applied, it
    is time to reformat the code to conform to the Linux style standard outlined
    in Documentation/CodingStyle.

    This patch contains the result of running scripts/Lindent against
    fs/reiserfs/*.c and include/linux/reiserfs_*.h. There are places where the
    code can be made to look better, but I'd rather keep those patches separate
    so that there isn't a subtle by-hand hand accident in the middle of a huge
    patch. To be clear: This patch is reformatting *only*.

    A number of patches may follow that continue to make the code more consistent
    with the Linux coding style.

    Hans wasn't particularly enthusiastic about these patches, but said he
    wouldn't really oppose them either.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

24 Jun, 2005

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds