summaryrefslogtreecommitdiff
path: root/kernel/power/tuxonice_io.c
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-04-23 04:02:05 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-04-23 04:02:05 -0300
commit394569928e2f17dff4ae367ac700048138e318c7 (patch)
treec789d2a2d107284e78f6c6558267b6984f518581 /kernel/power/tuxonice_io.c
parentbdcfd44fb5b5fb8fd660e7f93f1095c507481024 (diff)
Linux-libre 4.5.2-gnupck-4.5.2-gnu
Diffstat (limited to 'kernel/power/tuxonice_io.c')
-rw-r--r--kernel/power/tuxonice_io.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/kernel/power/tuxonice_io.c b/kernel/power/tuxonice_io.c
index 3c62c2682..2db934350 100644
--- a/kernel/power/tuxonice_io.c
+++ b/kernel/power/tuxonice_io.c
@@ -1232,24 +1232,28 @@ static inline int save_fs_info(struct fs_info *fs, struct block_device *bdev)
return (!fs || IS_ERR(fs) || !fs->last_mount_size) ? 0 : 1;
}
-int fs_info_space_needed(void)
+int fs_info_space_needed(int reset)
{
- const struct super_block *sb;
- int result = sizeof(int);
+ static int last_result = 0;
+ const struct super_block *sb;
+ int result = sizeof(int);
+ if (!last_result || reset) {
list_for_each_entry(sb, &super_blocks, s_list) {
- struct fs_info *fs;
+ struct fs_info *fs;
- if (!sb->s_bdev)
- continue;
+ if (!sb->s_bdev)
+ continue;
- fs = fs_info_from_block_dev(sb->s_bdev);
- if (save_fs_info(fs, sb->s_bdev))
- result += 16 + sizeof(dev_t) + sizeof(int) +
- fs->last_mount_size;
- free_fs_info(fs);
+ fs = fs_info_from_block_dev(sb->s_bdev);
+ if (save_fs_info(fs, sb->s_bdev))
+ result += 16 + sizeof(dev_t) + sizeof(int) +
+ fs->last_mount_size;
+ free_fs_info(fs);
}
- return result;
+ last_result = result;
+ }
+ return result;
}
static int fs_info_num_to_save(void)