linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>
To: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Cc: Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>,
	Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	kernel-TuqUDEhatI4ANWPb/1PvSmm0pvjS0E/A@public.gmane.org,
	Jens Axboe <jaxboe-5c4llco8/ftWk0Htik3J/w@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Micha?? Piotrowski
	<mkkp4x4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Chris Mason <chris.mason-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	Cesar Eduardo Barros
	<cesarb-PWySMVKUnqmsTnJN9+BGXg@public.gmane.org>,
	Alexander Viro
	<viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
Subject: Re: Dirtiable inode bdi default != sb bdi btrfs
Date: Wed, 29 Sep 2010 14:18:08 +0200	[thread overview]
Message-ID: <20100929121808.GB3290@quack.suse.cz> (raw)
In-Reply-To: <20100929081936.GA23322-jcswGhMUV9g@public.gmane.org>

On Wed 29-09-10 10:19:36, Christoph Hellwig wrote:
> ---
> From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> Subject: [PATCH] writeback: always use sb->s_bdi for writeback purposes
> 
...
> The one exception for now is the block device filesystem which really
> wants different writeback contexts for it's different (internal) inodes
> to handle the writeout more efficiently.  For now we do this with
> a hack in fs-writeback.c because we're so late in the cycle, but in
> the future I plan to replace this with a superblock method that allows
> for multiple writeback contexts per filesystem.
  Another exception I know about is mtd_inodefs filesystem
(drivers/mtd/mtdchar.c).

> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> 
> Index: linux-2.6/fs/fs-writeback.c
> ===================================================================
> --- linux-2.6.orig/fs/fs-writeback.c	2010-09-29 16:58:41.750557721 +0900
> +++ linux-2.6/fs/fs-writeback.c	2010-09-29 17:11:35.040557719 +0900
> @@ -72,22 +72,10 @@ int writeback_in_progress(struct backing
>  static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
>  {
>  	struct super_block *sb = inode->i_sb;
> -	struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info;
>  
> -	/*
> -	 * For inodes on standard filesystems, we use superblock's bdi. For
> -	 * inodes on virtual filesystems, we want to use inode mapping's bdi
> -	 * because they can possibly point to something useful (think about
> -	 * block_dev filesystem).
> -	 */
> -	if (sb->s_bdi && sb->s_bdi != &noop_backing_dev_info) {
> -		/* Some device inodes could play dirty tricks. Catch them... */
> -		WARN(bdi != sb->s_bdi && bdi_cap_writeback_dirty(bdi),
> -			"Dirtiable inode bdi %s != sb bdi %s\n",
> -			bdi->name, sb->s_bdi->name);
> -		return sb->s_bdi;
> -	}
> -	return bdi;
> +	if (strcmp(sb->s_type->name, "bdev") == 0)
> +		return inode->i_mapping->backing_dev_info;
> +	return sb->s_bdi;
  So at least here you'd need also add a similar exception for
"mtd_inodefs". Because of these exeptions I've chosen the
(sb->s_bdi && sb->s_bdi != &noop_backing_dev_info) check rather than your
exception based check. All in all I don't care much what ends up in the
kernel as it's just a temporary solution...
  Also I've added the warning to catch situations where inodes would get
filed to a different backing device after the patch. So far the reported
warnings were harmless but still I'm more comfortable when it's there
because otherwise we can so easily miss some device-driver-invented
filesystem like mtd_inodefs which would break silently after the change...

									Honza
-- 
Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>
SUSE Labs, CR

  parent reply	other threads:[~2010-09-29 12:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23  0:54 Dirtiable inode bdi default != sb bdi btrfs Cesar Eduardo Barros
2010-09-23 19:38 ` Andrew Morton
2010-09-23 19:40   ` Chris Mason
2010-09-23 19:40   ` Jens Axboe
2010-09-23 20:53     ` [stable] " Greg KH
2010-09-24 18:39       ` Jens Axboe
2010-09-27  0:15         ` Greg KH
2010-09-27 22:25   ` Jan Kara
2010-09-27 22:54     ` Chris Mason
2010-09-27 23:51       ` Jan Kara
2010-09-28  7:05       ` Artem Bityutskiy
2010-09-29 13:00         ` Jan Kara
2010-09-29 13:40           ` Artem Bityutskiy
2010-09-29  8:19       ` Christoph Hellwig
     [not found]       ` <20100929081936.GA23322@lst.de>
     [not found]         ` <20100929081936.GA23322-jcswGhMUV9g@public.gmane.org>
2010-09-29 12:18           ` Jan Kara [this message]
2010-09-29 14:10             ` Christoph Hellwig
2010-09-29 23:38               ` Jan Kara
2010-09-30  0:06                 ` Christoph Hellwig
2010-09-27 23:55     ` Cesar Eduardo Barros
     [not found]       ` <4CA12F01.2-PWySMVKUnqmsTnJN9+BGXg@public.gmane.org>
2010-09-29 13:01         ` Jan Kara

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=20100929121808.GB3290@quack.suse.cz \
    --to=jack-alswssmvlrq@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
    --cc=cesarb-PWySMVKUnqmsTnJN9+BGXg@public.gmane.org \
    --cc=chris.mason-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=jaxboe-5c4llco8/ftWk0Htik3J/w@public.gmane.org \
    --cc=kernel-TuqUDEhatI4ANWPb/1PvSmm0pvjS0E/A@public.gmane.org \
    --cc=linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mkkp4x4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    /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).