30 Jul, 2012

5 commits


23 Jul, 2012

35 commits

  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • all we need it for is file->private_data, which is assign-once, already
    assigned by that point and, incidentally, its value is already in use
    by zoran ->mmap() anyway. So just store that pointer instead...

    Signed-off-by: Al Viro

    Al Viro
     
  • ... and keep the sodding requests on stack - they are small enough.

    Signed-off-by: Al Viro

    Al Viro
     
  • d_instantiate(dentry, inode);
    unlock_new_inode(inode);

    is a bad idea; do it the other way round...

    Signed-off-by: Al Viro

    Al Viro
     
  • locking/unlocking for rcu walk taken to a couple of inline helpers

    Signed-off-by: Al Viro

    Al Viro
     
  • really convoluted test in there has grown up during struct mount
    introduction; what it checks is that we'd reached the root of
    mount tree.

    Al Viro
     
  • Use the new custom EOF argument to generic_file_llseek_size so
    that SEEK_END will go to the max hash value for htree dirs
    in ext3 rather than to i_size_read()

    Signed-off-by: Eric Sandeen
    Signed-off-by: Al Viro

    Eric Sandeen
     
  • Use the new functionality in generic_file_llseek_size() to
    accept a custom EOF position, and un-cut-and-paste all the
    vfs llseek code from ext4.

    Also fix up comments on ext4_llseek() to reflect reality.

    Signed-off-by: Eric Sandeen
    Signed-off-by: Al Viro

    Eric Sandeen
     
  • For ext3/4 htree directories, using the vfs llseek function with
    SEEK_END goes to i_size like for any other file, but in reality
    we want the maximum possible hash value. Recent changes
    in ext4 have cut & pasted generic_file_llseek() back into fs/ext4/dir.c,
    but replicating this core code seems like a bad idea, especially
    since the copy has already diverged from the vfs.

    This patch updates generic_file_llseek_size to accept
    both a custom maximum offset, and a custom EOF position. With this
    in place, ext4_dir_llseek can pass in the appropriate maximum hash
    position for both maxsize and eof, and get what it wants.

    As far as I know, this does not fix any bugs - nfs in the kernel
    doesn't use SEEK_END, and I don't know of any user who does. But
    some ext4 folks seem keen on doing the right thing here, and I can't
    really argue.

    (Patch also fixes up some comments slightly)

    Signed-off-by: Eric Sandeen
    Signed-off-by: Al Viro

    Eric Sandeen
     
  • wakeup_flusher_threads(0) will queue work doing complete writeback for each
    flusher thread. Thus there is not much point in submitting another work doing
    full inode WB_SYNC_NONE writeback by writeback_inodes_sb().

    After this change it does not make sense to call nonblocking ->sync_fs and
    block device flush before calling sync_inodes_sb() because
    wakeup_flusher_threads() is completely asynchronous and thus these functions
    would be called in parallel with inode writeback running which will effectively
    void any work they do. So we move sync_inodes_sb() call before these two
    functions.

    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     
  • It is not necessary to write block devices twice. The reason why we first did
    flush and then proper sync is that
    for_each_bdev() {
    write_bdev()
    wait_for_completion()
    }
    is much slower than
    for_each_bdev()
    write_bdev()
    for_each_bdev()
    wait_for_completion()
    when there is bigger amount of data. But as is seen in the above, there's no real
    need to scan pages and submit them twice. We just need to separate the submission
    and waiting part. This patch does that.

    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     
  • In case block device does not have filesystem mounted on it, sys_sync will just
    ignore it and doesn't writeout its dirty pages. This is because writeback code
    avoids writing inodes from superblock without backing device and
    blockdev_superblock is such a superblock. Since it's unexpected that sync
    doesn't writeout dirty data for block devices be nice to users and change the
    behavior to do so. So now we iterate over all block devices on blockdev_super
    instead of iterating over all superblocks when syncing block devices.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     
  • Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     
  • Change the order of operations during sync from

    for_each_sb {
    writeback_inodes_sb();
    sync_fs(nowait);
    __sync_blockdev(nowait);
    }
    for_each_sb {
    sync_inodes_sb();
    sync_fs(wait);
    __sync_blockdev(wait);
    }

    to

    for_each_sb
    writeback_inodes_sb();
    for_each_sb
    sync_fs(nowait);
    for_each_sb
    __sync_blockdev(nowait);
    for_each_sb
    sync_inodes_sb();
    for_each_sb
    sync_fs(wait);
    for_each_sb
    __sync_blockdev(wait);

    This is a preparation for the following patches in this series.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     
  • Since the moment writes to quota files are using block device page cache and
    space for quota structures is reserved at the moment they are first accessed we
    have no reason to sync quota before inode writeback. In fact this order is now
    only harmful since quota information can easily change during inode writeback
    (either because conversion of delayed-allocated extents or simply because of
    allocation of new blocks for simple filesystems not using page_mkwrite).

    So move syncing of quota information after writeback of inodes into ->sync_fs
    method. This way we do not have to use ->quota_sync callback which is primarily
    intended for use by quotactl syscall anyway and we get rid of calling
    ->sync_fs() twice unnecessarily. We skip quota syncing for OCFS2 since it does
    proper quota journalling in all cases (unlike ext3, ext4, and reiserfs which
    also support legacy non-journalled quotas) and thus there are no dirty quota
    structures.

    CC: "Theodore Ts'o"
    CC: Joel Becker
    CC: reiserfs-devel@vger.kernel.org
    Acked-by: Steven Whitehouse
    Acked-by: Dave Kleikamp
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     
  • Split off part of dquot_quota_sync() which writes dquots into a quota file
    to a separate function. In the next patch we will use the function from
    filesystems and we do not want to abuse ->quota_sync quotactl callback more
    than necessary.

    Acked-by: Steven Whitehouse
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     
  • In principle, a filesystem may want to have ->sync_fs() called during sync(1)
    although it does not have a bdi (i.e. s_bdi is set to noop_backing_dev_info).
    Only writeback code really needs bdi set to something reasonable. So move the
    checks where they are more logical.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     
  • This patch makes UFS stop using the VFS '->write_super()' method along with
    the 's_dirt' superblock flag, because they are on their way out.

    The way we implement this is that we schedule a delay job instead relying on
    's_dirt' and '->write_super()'.

    The whole "superblock write-out" VFS infrastructure is served by the
    'sync_supers()' kernel thread, which wakes up every 5 (by default) seconds and
    writes out all dirty superblocks using the '->write_super()' call-back. But the
    problem with this thread is that it wastes power by waking up the system every
    5 seconds, even if there are no diry superblocks, or there are no client
    file-systems which would need this (e.g., btrfs does not use
    '->write_super()'). So we want to kill it completely and thus, we need to make
    file-systems to stop using the '->write_super()' VFS service, and then remove
    it together with the kernel thread.

    Tested using fsstress from the LTP project.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • This patch does not do any functional changes. It only moves 3 functions
    in fs/ufs/super.c a little bit up in order to prepare for further changes
    where I'll need this new arrangement to avoid forward declarations.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • UFS calls 'ufs_write_super()' from 'ufs_put_super()' in order to write the
    superblocks to the media. However, it is not needed because VFS calls
    '->sync_fs()' before calling '->put_super()' - so by the time we are in
    'ufs_write_super()', the superblocks are already synchronized.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • It does not look like sysv FS needs 'write_super()' at all, because all it
    does is a timestamp update. I cannot test this patch, because this
    file-system is so old and probably has not been used by anyone for years,
    so there are no tools to create it in Linux. But from the code I see that
    marking the superblock as dirty is basically marking the superblock buffers as
    drity and then setting the s_dirt flag. And when 'write_super()' is executed to
    handle the s_dirt flag, we just update the timestamp and again mark the
    superblock buffer as dirty. Seems pointless.

    It looks like we can update the timestamp more opprtunistically - on unmount
    or remount of sync, and nothing should change.

    Thus, this patch removes 'sysv_write_super()' and 's_dirt'.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • We do not need to call 'sysv_write_super()' from 'sysv_remount()',
    because VFS has called 'sysv_sync_fs()' before calling '->remount()'.
    So remove it. Remove also '(un)lock_super()' which obvioulsy is becoming
    useless in this function.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • We do not need to call 'sysv_write_super()' from 'sysv_put_super()',
    because VFS has called 'sysv_sync_fs()' before calling '->put_super()'.
    So remove it.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • This patch makes hfs stop using the VFS '->write_super()' method along with
    the 's_dirt' superblock flag, because they are on their way out.

    The whole "superblock write-out" VFS infrastructure is served by the
    'sync_supers()' kernel thread, which wakes up every 5 (by default) seconds and
    writes out all dirty superblocks using the '->write_super()' call-back. But the
    problem with this thread is that it wastes power by waking up the system every
    5 seconds, even if there are no diry superblocks, or there are no client
    file-systems which would need this (e.g., btrfs does not use
    '->write_super()'). So we want to kill it completely and thus, we need to make
    file-systems to stop using the '->write_super()' VFS service, and then remove
    it together with the kernel thread.

    Tested using fsstress from the LTP project.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • Add an 'sb' VFS superblock back-reference to the 'struct hfs_sb_info' data
    structure - we will need to find the VFS superblock from a
    'struct hfs_sb_info' object in the next patch, so this change is jut a
    preparation.

    Remove few useless newlines while on it.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • We have the following pattern in 2 places in HFS

    if (!RDONLY)
    hfs_mdb_commit();

    This patch pushes the RDONLY check down to 'hfs_mdb_commit()'. This will
    make the following patches a bit simpler.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • HFS calls 'hfs_write_super()' from 'hfs_put_super()' in order to write the MDB
    to the media. However, it is not needed because VFS calls '->sync_fs()' before
    calling '->put_super()' - so by the time we are in 'hfs_write_super()', the MDB
    is already synchronized.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • Stop using lock_super for serializing the MDB changes - use the buffer-head own
    lock instead. Tested with fsstress.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • HFS uses 'lock_super()'/'unlock_super()' around 'hfs_mdb_commit()' in order
    to serialize MDB (Master Directory Block) changes. Push it down to
    'hfs_mdb_commit()' in order to simplify the code a bit.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • This patch makes hfsplus stop using the VFS '->write_super()' method along with
    the 's_dirt' superblock flag, because they are on their way out.

    The whole "superblock write-out" VFS infrastructure is served by the
    'sync_supers()' kernel thread, which wakes up every 5 (by default) seconds and
    writes out all dirty superblocks using the '->write_super()' call-back. But the
    problem with this thread is that it wastes power by waking up the system every
    5 seconds, even if there are no diry superblocks, or there are no client
    file-systems which would need this (e.g., btrfs does not use
    '->write_super()'). So we want to kill it completely and thus, we need to make
    file-systems to stop using the '->write_super()' VFS service, and then remove
    it together with the kernel thread.

    Tested using fsstress from the LTP project.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • This check is useless because we always have 'sb->s_fs_info' to be non-NULL.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy
     
  • Print correct function name in the debugging print of the
    'hfsplus_sync_fs()' function.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Al Viro

    Artem Bityutskiy