From patchwork Wed Mar 16 20:30:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Moyer X-Patchwork-Id: 639901 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2GKbbaN008249 for ; Wed, 16 Mar 2011 20:37:58 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2GKUVsD000607; Wed, 16 Mar 2011 16:30:33 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2GKUTNn022518 for ; Wed, 16 Mar 2011 16:30:29 -0400 Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.16.60.26]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2GKUMZp024630; Wed, 16 Mar 2011 16:30:23 -0400 From: Jeff Moyer To: NeilBrown References: <20110217165057.5c50e566@notabene.brown> <20110303143120.GA8134@infradead.org> <20110304111624.4be27aaf@notabene.brown> <1299259506.2118.24.camel@grinch> <20110306174755.49404c8e@notabene.brown> <1299471771.2228.11.camel@grinch> <1299516418.15258.4.camel@mulgrave.site> <20110308094412.1c45b277@notabene.brown> <1299538572.15955.90.camel@mulgrave.site> <20110308110453.0047307d@notabene.brown> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Wed, 16 Mar 2011 16:30:22 -0400 In-Reply-To: <20110308110453.0047307d@notabene.brown> (NeilBrown's message of "Tue, 8 Mar 2011 11:04:53 +1100") Message-ID: User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: Jens Axboe , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, device-mapper development , James Bottomley , linux-fsdevel@vger.kernel.org Subject: Re: [dm-devel] [PATCH] Fix over-zealous flush_disk when changing device size. X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 16 Mar 2011 20:37:59 +0000 (UTC) diff --git a/block/genhd.c b/block/genhd.c index cbf1112..6a5b772 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1355,7 +1355,7 @@ int invalidate_partition(struct gendisk *disk, int partno) struct block_device *bdev = bdget_disk(disk, partno); if (bdev) { fsync_bdev(bdev); - res = __invalidate_device(bdev, true); + res = __invalidate_device(bdev); bdput(bdev); } return res; diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 77fc76f..b9ba04f 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3281,7 +3281,7 @@ static int set_geometry(unsigned int cmd, struct floppy_struct *g, struct block_device *bdev = opened_bdev[cnt]; if (!bdev || ITYPE(drive_state[cnt].fd_device) != type) continue; - __invalidate_device(bdev, true); + __invalidate_device(bdev); } mutex_unlock(&open_lock); } else { diff --git a/fs/block_dev.c b/fs/block_dev.c index 8892870..5aae241 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -934,9 +934,9 @@ EXPORT_SYMBOL_GPL(bd_unlink_disk_holder); * when a disk has been changed -- either by a media change or online * resize. */ -static void flush_disk(struct block_device *bdev, bool kill_dirty) +static void flush_disk(struct block_device *bdev) { - if (__invalidate_device(bdev, kill_dirty)) { + if (__invalidate_device(bdev)) { char name[BDEVNAME_SIZE] = ""; if (bdev->bd_disk) @@ -973,7 +973,7 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev) "%s: detected capacity change from %lld to %lld\n", name, bdev_size, disk_size); i_size_write(bdev->bd_inode, disk_size); - flush_disk(bdev, false); + fsync_bdev(bdev); } } EXPORT_SYMBOL(check_disk_size_change); @@ -1026,7 +1026,7 @@ int check_disk_change(struct block_device *bdev) if (!(events & DISK_EVENT_MEDIA_CHANGE)) return 0; - flush_disk(bdev, true); + flush_disk(bdev); if (bdops->revalidate_disk) bdops->revalidate_disk(bdev->bd_disk); return 1; @@ -1607,7 +1607,7 @@ fail: } EXPORT_SYMBOL(lookup_bdev); -int __invalidate_device(struct block_device *bdev, bool kill_dirty) +int __invalidate_device(struct block_device *bdev) { struct super_block *sb = get_super(bdev); int res = 0; @@ -1620,7 +1620,7 @@ int __invalidate_device(struct block_device *bdev, bool kill_dirty) * hold). */ shrink_dcache_sb(sb); - res = invalidate_inodes(sb, kill_dirty); + res = invalidate_inodes(sb); drop_super(sb); } invalidate_bdev(bdev); diff --git a/fs/inode.c b/fs/inode.c index 0647d80..9c2b795 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -548,14 +548,11 @@ void evict_inodes(struct super_block *sb) /** * invalidate_inodes - attempt to free all inodes on a superblock * @sb: superblock to operate on - * @kill_dirty: flag to guide handling of dirty inodes * * Attempts to free all inodes for a given superblock. If there were any * busy inodes return a non-zero value, else zero. - * If @kill_dirty is set, discard dirty inodes too, otherwise treat - * them as busy. */ -int invalidate_inodes(struct super_block *sb, bool kill_dirty) +int invalidate_inodes(struct super_block *sb) { int busy = 0; struct inode *inode, *next; @@ -567,10 +564,6 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty) list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) continue; - if (inode->i_state & I_DIRTY && !kill_dirty) { - busy = 1; - continue; - } if (atomic_read(&inode->i_count)) { busy = 1; continue; diff --git a/fs/internal.h b/fs/internal.h index f3d15de..bee95ea 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -125,4 +125,4 @@ extern long do_handle_open(int mountdirfd, */ extern int get_nr_dirty_inodes(void); extern void evict_inodes(struct super_block *); -extern int invalidate_inodes(struct super_block *, bool); +extern int invalidate_inodes(struct super_block *); diff --git a/include/linux/fs.h b/include/linux/fs.h index 13df14e..ff9a159 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2155,7 +2155,7 @@ extern void check_disk_size_change(struct gendisk *disk, struct block_device *bdev); extern int revalidate_disk(struct gendisk *); extern int check_disk_change(struct block_device *); -extern int __invalidate_device(struct block_device *, bool); +extern int __invalidate_device(struct block_device *); extern int invalidate_partition(struct gendisk *, int); #endif unsigned long invalidate_mapping_pages(struct address_space *mapping,