Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233660
b: refs/heads/master
c: 93b270f
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown committed Feb 24, 2011
1 parent 6ccc28f commit 0b75775
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da9cf5050a2e3dbc3cf26a8d908482eb4485ed49
refs/heads/master: 93b270f76e7ef3b81001576860c2701931cdc78b
2 changes: 1 addition & 1 deletion trunk/block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
res = __invalidate_device(bdev, true);
bdput(bdev);
}
return res;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
__invalidate_device(bdev, true);
}
mutex_unlock(&open_lock);
} else {
Expand Down
12 changes: 6 additions & 6 deletions trunk/fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,9 +927,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)
static void flush_disk(struct block_device *bdev, bool kill_dirty)
{
if (__invalidate_device(bdev)) {
if (__invalidate_device(bdev, kill_dirty)) {
char name[BDEVNAME_SIZE] = "";

if (bdev->bd_disk)
Expand Down Expand Up @@ -966,7 +966,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);
flush_disk(bdev, false);
}
}
EXPORT_SYMBOL(check_disk_size_change);
Expand Down Expand Up @@ -1019,7 +1019,7 @@ int check_disk_change(struct block_device *bdev)
if (!(events & DISK_EVENT_MEDIA_CHANGE))
return 0;

flush_disk(bdev);
flush_disk(bdev, true);
if (bdops->revalidate_disk)
bdops->revalidate_disk(bdev->bd_disk);
return 1;
Expand Down Expand Up @@ -1601,7 +1601,7 @@ struct block_device *lookup_bdev(const char *pathname)
}
EXPORT_SYMBOL(lookup_bdev);

int __invalidate_device(struct block_device *bdev)
int __invalidate_device(struct block_device *bdev, bool kill_dirty)
{
struct super_block *sb = get_super(bdev);
int res = 0;
Expand All @@ -1614,7 +1614,7 @@ int __invalidate_device(struct block_device *bdev)
* hold).
*/
shrink_dcache_sb(sb);
res = invalidate_inodes(sb);
res = invalidate_inodes(sb, kill_dirty);
drop_super(sb);
}
invalidate_bdev(bdev);
Expand Down
9 changes: 8 additions & 1 deletion trunk/fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,14 @@ 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)
int invalidate_inodes(struct super_block *sb, bool kill_dirty)
{
int busy = 0;
struct inode *inode, *next;
Expand All @@ -556,6 +559,10 @@ int invalidate_inodes(struct super_block *sb)
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;
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ extern void release_open_intent(struct nameidata *);
*/
extern int get_nr_dirty_inodes(void);
extern void evict_inodes(struct super_block *);
extern int invalidate_inodes(struct super_block *);
extern int invalidate_inodes(struct super_block *, bool);
2 changes: 1 addition & 1 deletion trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2139,7 +2139,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 *);
extern int __invalidate_device(struct block_device *, bool);
extern int invalidate_partition(struct gendisk *, int);
#endif
unsigned long invalidate_mapping_pages(struct address_space *mapping,
Expand Down

0 comments on commit 0b75775

Please sign in to comment.