mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: MITSUNARI Shigeo <herumi@nifty.com>
To: linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	MITSUNARI Shigeo <herumi@nifty.com>
Subject: [PATCH 2/2] block: fs: move 'bdev->bd_invalidated = 0' into check_disk_size_change() instead of putting the code every time after check_disk_size_change().
Date: Fri, 19 Oct 2012 12:16:42 +0900	[thread overview]
Message-ID: <1350616602-6892-3-git-send-email-herumi@nifty.com> (raw)
In-Reply-To: <1350616602-6892-1-git-send-email-herumi@nifty.com>

The following code appeares in invalidate_partitions(), rescan_partitions() and revalidate_disk().

>check_disk_size_change(disk, bdev);
>bdev->bd_invalidted = 0;

check_disk_size_change() is called from only those three functions.
so how about setting bdev->bd_invalidated = 0 in check_disk_size_change()?

Signed-off-by: MITSUNARI Shigeo <herumi@nifty.com>
---
 block/partition-generic.c |    2 --
 fs/block_dev.c            |    2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/block/partition-generic.c b/block/partition-generic.c
index f1d1451..6a65169 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -429,7 +429,6 @@ rescan:
 	if (disk->fops->revalidate_disk)
 		disk->fops->revalidate_disk(disk);
 	check_disk_size_change(disk, bdev);
-	bdev->bd_invalidated = 0;
 	if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
 		return 0;
 	if (IS_ERR(state)) {
@@ -542,7 +541,6 @@ int invalidate_partitions(struct gendisk *disk, struct block_device *bdev)
 
 	set_capacity(disk, 0);
 	check_disk_size_change(disk, bdev);
-	bdev->bd_invalidated = 0;
 	/* tell userspace that the media / partition table may have changed */
 	kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE);
 
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 2577cf4..ef0189b 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1022,6 +1022,7 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev)
 		i_size_write(bdev->bd_inode, disk_size);
 		flush_disk(bdev, false);
 	}
+	bdev->bd_invalidated = 0;
 }
 EXPORT_SYMBOL(check_disk_size_change);
 
@@ -1047,7 +1048,6 @@ int revalidate_disk(struct gendisk *disk)
 
 	mutex_lock(&bdev->bd_mutex);
 	check_disk_size_change(disk, bdev);
-	bdev->bd_invalidated = 0;
 	mutex_unlock(&bdev->bd_mutex);
 	bdput(bdev);
 	return ret;
-- 
1.7.9.5


      parent reply	other threads:[~2012-10-19  3:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19  3:16 [PATCH 0/2] bd_invalidated shoud be cleared in revalidate_disk MITSUNARI Shigeo
2012-10-19  3:16 ` [PATCH 1/2] block: fs: bd_invalidated should " MITSUNARI Shigeo
2012-10-19  3:16 ` MITSUNARI Shigeo [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=1350616602-6892-3-git-send-email-herumi@nifty.com \
    --to=herumi@nifty.com \
    --cc=axboe@kernel.dk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®