lkml.org 
[lkml]   [2009]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: vfs: Add MS_FLUSHONFSYNC mount flag
    From
    Date
    On Sat, 2009-02-14 at 22:03 +0900, Fernando Luis Vázquez Cao wrote:
    > > > 2- Modify file_fsync() so that it checks whether FLUSHONFSYNC is set and
    > > > flushes the underlying device accordingly. With this we would cover all
    > > > filesystems that use the vfs-provided file_fsync() as their fsync method
    > > > (commonly used filesystems such as fat fall in this group).
    > >
    > > Just make it flush the block device.
    >
    > I wrote a patch that does exactly that but, in addition, it checks
    > whether FLUSHONFSYNC is set to avoid sending unnecessary flushes down
    > the block layer (this patch is not included in this patch-set, but I
    > will add it in the next iteration).

    I probably should have mentioned in my proposal all filesystems would
    just call the helper function block_flush_device() to flush the
    underlying block device, unconditionally.

    This helper function looks like this:

    +/* Issue flush of write caches on the block device */
    +int block_flush_device(struct super_block *sb)
    +{
    + int ret = 0;
    +
    + if (!(sb->s_flags & MS_FLUSHONFSYNC))
    + return ret;
    +
    + ret = blkdev_issue_flush(sb->s_bdev, NULL);
    +
    + if (ret == -EOPNOTSUPP)
    + return 0;
    +
    + return ret;
    +}

    As you can see the check for flushonfsync is done here, so changing my
    patches along the lines you suggest would be a trivial two lines patch.

    - Fernando

    > As I mentioned above, if everyone thinks this small optimization not
    > elegant or an undesirable layering violation I will remove it.



    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2009-02-14 14:23    [W:3.587 / U:0.424 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site