From f6f14a0d71b0773a1d4147d1a3c33d537cd213ab Mon Sep 17 00:00:00 2001 From: Russell King Date: Mon, 9 Dec 2019 11:08:59 +0000 Subject: fs/adfs: map: move map-specific sb initialisation to map.c Move map specific superblock initialisation to map.c, rather than having it spread into super.c. Signed-off-by: Russell King Signed-off-by: Al Viro --- fs/adfs/map.c | 13 +++++++++---- fs/adfs/super.c | 7 +------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'fs/adfs') diff --git a/fs/adfs/map.c b/fs/adfs/map.c index 9be0b47da19c..82e1bf101fe6 100644 --- a/fs/adfs/map.c +++ b/fs/adfs/map.c @@ -355,14 +355,19 @@ struct adfs_discmap *adfs_read_map(struct super_block *sb, struct adfs_discrecor unsigned int map_addr, zone_size, nzones; int ret; - nzones = asb->s_map_size; + nzones = dr->nzones | dr->nzones_high << 8; zone_size = (8 << dr->log2secsize) - le16_to_cpu(dr->zone_spare); - map_addr = (nzones >> 1) * zone_size - - ((nzones > 1) ? ADFS_DR_SIZE_BITS : 0); - map_addr = signed_asl(map_addr, asb->s_map2blk); + asb->s_idlen = dr->idlen; + asb->s_map_size = nzones; + asb->s_map2blk = dr->log2bpmb - dr->log2secsize; + asb->s_log2sharesize = dr->log2sharesize; asb->s_ids_per_zone = zone_size / (asb->s_idlen + 1); + map_addr = (nzones >> 1) * zone_size - + ((nzones > 1) ? ADFS_DR_SIZE_BITS : 0); + map_addr = signed_asl(map_addr, asb->s_map2blk); + dm = kmalloc_array(nzones, sizeof(*dm), GFP_KERNEL); if (dm == NULL) { adfs_error(sb, "not enough memory"); diff --git a/fs/adfs/super.c b/fs/adfs/super.c index cef16028e9f2..b2455e9ab923 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c @@ -289,6 +289,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) return -ENOMEM; sb->s_fs_info = asb; + sb->s_magic = ADFS_SUPER_MAGIC; sb->s_time_gran = 10000000; /* set default options */ @@ -356,12 +357,6 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) * blocksize on this device should now be set to the ADFS log2secsize */ - sb->s_magic = ADFS_SUPER_MAGIC; - asb->s_idlen = dr->idlen; - asb->s_map_size = dr->nzones | (dr->nzones_high << 8); - asb->s_map2blk = dr->log2bpmb - dr->log2secsize; - asb->s_log2sharesize = dr->log2sharesize; - asb->s_map = adfs_read_map(sb, dr); if (IS_ERR(asb->s_map)) { ret = PTR_ERR(asb->s_map); -- cgit v1.2.3-70-g09d2