Upgrade to 4.4.50-rt62
[kvmfornfv.git] / kernel / fs / affs / super.c
index 3f89c9e..f90c535 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/writeback.h>
+#include <linux/blkdev.h>
 #include "affs.h"
 
 static int affs_statfs(struct dentry *dentry, struct kstatfs *buf);
@@ -352,18 +353,19 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
         * blocks, we will have to change it.
         */
 
-       size = sb->s_bdev->bd_inode->i_size >> 9;
+       size = i_size_read(sb->s_bdev->bd_inode) >> 9;
        pr_debug("initial blocksize=%d, #blocks=%d\n", 512, size);
 
        affs_set_blocksize(sb, PAGE_SIZE);
        /* Try to find root block. Its location depends on the block size. */
 
-       i = 512;
-       j = 4096;
+       i = bdev_logical_block_size(sb->s_bdev);
+       j = PAGE_SIZE;
        if (blocksize > 0) {
                i = j = blocksize;
                size = size / (blocksize / 512);
        }
+
        for (blocksize = i; blocksize <= j; blocksize <<= 1, size >>= 1) {
                sbi->s_root_block = root_block;
                if (root_block < 0)
@@ -526,7 +528,7 @@ affs_remount(struct super_block *sb, int *flags, char *data)
        char                    *prefix = NULL;
 
        new_opts = kstrdup(data, GFP_KERNEL);
-       if (!new_opts)
+       if (data && !new_opts)
                return -ENOMEM;
 
        pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data);
@@ -544,7 +546,8 @@ affs_remount(struct super_block *sb, int *flags, char *data)
        }
 
        flush_delayed_work(&sbi->sb_work);
-       replace_mount_options(sb, new_opts);
+       if (new_opts)
+               replace_mount_options(sb, new_opts);
 
        sbi->s_flags = mount_flags;
        sbi->s_mode  = mode;