linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Sage Weil <sage@newdream.net>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] FS_IOC_SYNCFS
Date: Fri, 23 Jul 2010 18:24:43 +0200	[thread overview]
Message-ID: <20100723162443.GA20540@quack.suse.cz> (raw)
In-Reply-To: <Pine.LNX.4.64.1007201004380.6477@cobra.newdream.net>

On Tue 20-07-10 16:48:26, Sage Weil wrote:
> As far as I can see, currently the only way to sync a single file system 
> (and not _all_ mounted file systems) is via the BLKFLSBUF ioctl, which 
> will sync_filesystem() and then invalidate_bdev().  If you _just_ want to 
> sync, though, the invalidate_bdev() is unnecessary and potentially 
> counter-productive.
> 
> Would it be reasonable to add a simple call like so?  Then you could
> 
> 	fd = open("/path/for/some/mount", O_RDONLY);
> 	ioctl(fd, FS_IOC_SYNCFS);
> 	close(fd);
> 
> or something along those lines.
  Looks reasonable to me...

								Honza

> diff --git a/fs/ioctl.c b/fs/ioctl.c
> index 2d140a7..0bc9f7a 100644
> --- a/fs/ioctl.c
> +++ b/fs/ioctl.c
> @@ -593,6 +593,9 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
>  	case FS_IOC_FIEMAP:
>  		return ioctl_fiemap(filp, arg);
>  
> +	case FS_IOC_SYNCFS:
> +		return sync_filesystem(filp->f_dentry->d_sb);
> +
>  	case FIGETBSZ:
>  	{
>  		struct inode *inode = filp->f_path.dentry->d_inode;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 471e1ff..4a84d78 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -321,6 +321,7 @@ struct inodes_stat_t {
>  #define	FS_IOC_GETVERSION		_IOR('v', 1, long)
>  #define	FS_IOC_SETVERSION		_IOW('v', 2, long)
>  #define FS_IOC_FIEMAP			_IOWR('f', 11, struct fiemap)
> +#define FS_IOC_SYNCFS                   _IO('S', 12)
>  #define FS_IOC32_GETFLAGS		_IOR('f', 1, int)
>  #define FS_IOC32_SETFLAGS		_IOW('f', 2, int)
>  #define FS_IOC32_GETVERSION		_IOR('v', 1, int)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      reply	other threads:[~2010-07-23 16:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-20 23:48 [RFC] FS_IOC_SYNCFS Sage Weil
2010-07-23 16:24 ` Jan Kara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100723162443.GA20540@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sage@newdream.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).