Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * linux/fs/adfs/map.c |
| 4 | * |
| 5 | * Copyright (C) 1997-2002 Russell King |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | */ |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 7 | #include <linux/slab.h> |
Russell King | e6160e4 | 2019-12-09 11:08:34 +0000 | [diff] [blame] | 8 | #include <linux/statfs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <asm/unaligned.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include "adfs.h" |
| 11 | |
| 12 | /* |
| 13 | * The ADFS map is basically a set of sectors. Each sector is called a |
| 14 | * zone which contains a bitstream made up of variable sized fragments. |
| 15 | * Each bit refers to a set of bytes in the filesystem, defined by |
| 16 | * log2bpmb. This may be larger or smaller than the sector size, but |
| 17 | * the overall size it describes will always be a round number of |
| 18 | * sectors. A fragment id is always idlen bits long. |
| 19 | * |
| 20 | * < idlen > < n > <1> |
| 21 | * +---------+-------//---------+---+ |
| 22 | * | frag id | 0000....000000 | 1 | |
| 23 | * +---------+-------//---------+---+ |
| 24 | * |
| 25 | * The physical disk space used by a fragment is taken from the start of |
| 26 | * the fragment id up to and including the '1' bit - ie, idlen + n + 1 |
| 27 | * bits. |
| 28 | * |
| 29 | * A fragment id can be repeated multiple times in the whole map for |
| 30 | * large or fragmented files. The first map zone a fragment starts in |
| 31 | * is given by fragment id / ids_per_zone - this allows objects to start |
| 32 | * from any zone on the disk. |
| 33 | * |
| 34 | * Free space is described by a linked list of fragments. Each free |
| 35 | * fragment describes free space in the same way as the other fragments, |
| 36 | * however, the frag id specifies an offset (in map bits) from the end |
| 37 | * of this fragment to the start of the next free fragment. |
| 38 | * |
| 39 | * Objects stored on the disk are allocated object ids (we use these as |
| 40 | * our inode numbers.) Object ids contain a fragment id and an optional |
| 41 | * offset. This allows a directory fragment to contain small files |
| 42 | * associated with that directory. |
| 43 | */ |
| 44 | |
| 45 | /* |
| 46 | * For the future... |
| 47 | */ |
| 48 | static DEFINE_RWLOCK(adfs_map_lock); |
| 49 | |
| 50 | /* |
| 51 | * This is fun. We need to load up to 19 bits from the map at an |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 52 | * arbitrary bit alignment. (We're limited to 19 bits by F+ version 2). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | */ |
| 54 | #define GET_FRAG_ID(_map,_start,_idmask) \ |
| 55 | ({ \ |
| 56 | unsigned char *_m = _map + (_start >> 3); \ |
Al Viro | 224c886 | 2009-06-08 00:46:40 -0400 | [diff] [blame] | 57 | u32 _frag = get_unaligned_le32(_m); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | _frag >>= (_start & 7); \ |
| 59 | _frag & _idmask; \ |
| 60 | }) |
| 61 | |
| 62 | /* |
| 63 | * return the map bit offset of the fragment frag_id in the zone dm. |
| 64 | * Note that the loop is optimised for best asm code - look at the |
| 65 | * output of: |
| 66 | * gcc -D__KERNEL__ -O2 -I../../include -o - -S map.c |
| 67 | */ |
Russell King | 5ed70bb | 2019-06-04 14:49:57 +0100 | [diff] [blame] | 68 | static int lookup_zone(const struct adfs_discmap *dm, const unsigned int idlen, |
| 69 | const u32 frag_id, unsigned int *offset) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | { |
Russell King | 197ba3c | 2019-12-09 11:08:49 +0000 | [diff] [blame] | 71 | const unsigned int endbit = dm->dm_endbit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | const u32 idmask = (1 << idlen) - 1; |
Russell King | 197ba3c | 2019-12-09 11:08:49 +0000 | [diff] [blame] | 73 | unsigned char *map = dm->dm_bh->b_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | unsigned int start = dm->dm_startbit; |
Russell King | 792314f | 2019-12-09 11:08:54 +0000 | [diff] [blame] | 75 | unsigned int fragend; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | u32 frag; |
| 77 | |
| 78 | do { |
| 79 | frag = GET_FRAG_ID(map, start, idmask); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
Russell King | 792314f | 2019-12-09 11:08:54 +0000 | [diff] [blame] | 81 | fragend = find_next_bit_le(map, endbit, start + idlen); |
| 82 | if (fragend >= endbit) |
| 83 | goto error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
Russell King | 792314f | 2019-12-09 11:08:54 +0000 | [diff] [blame] | 85 | if (frag == frag_id) { |
| 86 | unsigned int length = fragend + 1 - start; |
| 87 | |
| 88 | if (*offset < length) |
| 89 | return start + *offset; |
| 90 | *offset -= length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Russell King | 792314f | 2019-12-09 11:08:54 +0000 | [diff] [blame] | 93 | start = fragend + 1; |
| 94 | } while (start < endbit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | return -1; |
| 96 | |
| 97 | error: |
| 98 | printk(KERN_ERR "adfs: oversized fragment 0x%x at 0x%x-0x%x\n", |
Russell King | 792314f | 2019-12-09 11:08:54 +0000 | [diff] [blame] | 99 | frag, start, fragend); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | return -1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | /* |
| 104 | * Scan the free space map, for this zone, calculating the total |
| 105 | * number of map bits in each free space fragment. |
| 106 | * |
| 107 | * Note: idmask is limited to 15 bits [3.2] |
| 108 | */ |
| 109 | static unsigned int |
| 110 | scan_free_map(struct adfs_sb_info *asb, struct adfs_discmap *dm) |
| 111 | { |
Russell King | 197ba3c | 2019-12-09 11:08:49 +0000 | [diff] [blame] | 112 | const unsigned int endbit = dm->dm_endbit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | const unsigned int idlen = asb->s_idlen; |
| 114 | const unsigned int frag_idlen = idlen <= 15 ? idlen : 15; |
| 115 | const u32 idmask = (1 << frag_idlen) - 1; |
| 116 | unsigned char *map = dm->dm_bh->b_data; |
Russell King | 792314f | 2019-12-09 11:08:54 +0000 | [diff] [blame] | 117 | unsigned int start = 8, fragend; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | u32 frag; |
| 119 | unsigned long total = 0; |
| 120 | |
| 121 | /* |
| 122 | * get fragment id |
| 123 | */ |
| 124 | frag = GET_FRAG_ID(map, start, idmask); |
| 125 | |
| 126 | /* |
| 127 | * If the freelink is null, then no free fragments |
| 128 | * exist in this zone. |
| 129 | */ |
| 130 | if (frag == 0) |
| 131 | return 0; |
| 132 | |
| 133 | do { |
| 134 | start += frag; |
| 135 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | frag = GET_FRAG_ID(map, start, idmask); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | |
Russell King | 792314f | 2019-12-09 11:08:54 +0000 | [diff] [blame] | 138 | fragend = find_next_bit_le(map, endbit, start + idlen); |
| 139 | if (fragend >= endbit) |
| 140 | goto error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | |
Russell King | 792314f | 2019-12-09 11:08:54 +0000 | [diff] [blame] | 142 | total += fragend + 1 - start; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | } while (frag >= idlen + 1); |
| 144 | |
| 145 | if (frag != 0) |
| 146 | printk(KERN_ERR "adfs: undersized free fragment\n"); |
| 147 | |
| 148 | return total; |
| 149 | error: |
| 150 | printk(KERN_ERR "adfs: oversized free fragment\n"); |
| 151 | return 0; |
| 152 | } |
| 153 | |
Russell King | 5ed70bb | 2019-06-04 14:49:57 +0100 | [diff] [blame] | 154 | static int scan_map(struct adfs_sb_info *asb, unsigned int zone, |
| 155 | const u32 frag_id, unsigned int mapoff) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | { |
| 157 | const unsigned int idlen = asb->s_idlen; |
| 158 | struct adfs_discmap *dm, *dm_end; |
| 159 | int result; |
| 160 | |
| 161 | dm = asb->s_map + zone; |
| 162 | zone = asb->s_map_size; |
| 163 | dm_end = asb->s_map + zone; |
| 164 | |
| 165 | do { |
| 166 | result = lookup_zone(dm, idlen, frag_id, &mapoff); |
| 167 | |
| 168 | if (result != -1) |
| 169 | goto found; |
| 170 | |
| 171 | dm ++; |
| 172 | if (dm == dm_end) |
| 173 | dm = asb->s_map; |
| 174 | } while (--zone > 0); |
| 175 | |
| 176 | return -1; |
| 177 | found: |
| 178 | result -= dm->dm_startbit; |
| 179 | result += dm->dm_startblk; |
| 180 | |
| 181 | return result; |
| 182 | } |
| 183 | |
| 184 | /* |
| 185 | * calculate the amount of free blocks in the map. |
| 186 | * |
| 187 | * n=1 |
| 188 | * total_free = E(free_in_zone_n) |
| 189 | * nzones |
| 190 | */ |
Russell King | e6160e4 | 2019-12-09 11:08:34 +0000 | [diff] [blame] | 191 | void adfs_map_statfs(struct super_block *sb, struct kstatfs *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | { |
| 193 | struct adfs_sb_info *asb = ADFS_SB(sb); |
Russell King | e6160e4 | 2019-12-09 11:08:34 +0000 | [diff] [blame] | 194 | struct adfs_discrecord *dr = adfs_map_discrecord(asb->s_map); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | struct adfs_discmap *dm; |
| 196 | unsigned int total = 0; |
| 197 | unsigned int zone; |
| 198 | |
| 199 | dm = asb->s_map; |
| 200 | zone = asb->s_map_size; |
| 201 | |
| 202 | do { |
| 203 | total += scan_free_map(asb, dm++); |
| 204 | } while (--zone > 0); |
| 205 | |
Russell King | e6160e4 | 2019-12-09 11:08:34 +0000 | [diff] [blame] | 206 | buf->f_blocks = adfs_disc_size(dr) >> sb->s_blocksize_bits; |
| 207 | buf->f_files = asb->s_ids_per_zone * asb->s_map_size; |
| 208 | buf->f_bavail = |
| 209 | buf->f_bfree = signed_asl(total, asb->s_map2blk); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | } |
| 211 | |
Russell King | 5ed70bb | 2019-06-04 14:49:57 +0100 | [diff] [blame] | 212 | int adfs_map_lookup(struct super_block *sb, u32 frag_id, unsigned int offset) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | { |
| 214 | struct adfs_sb_info *asb = ADFS_SB(sb); |
| 215 | unsigned int zone, mapoff; |
| 216 | int result; |
| 217 | |
| 218 | /* |
| 219 | * map & root fragment is special - it starts in the center of the |
| 220 | * disk. The other fragments start at zone (frag / ids_per_zone) |
| 221 | */ |
| 222 | if (frag_id == ADFS_ROOT_FRAG) |
| 223 | zone = asb->s_map_size >> 1; |
| 224 | else |
| 225 | zone = frag_id / asb->s_ids_per_zone; |
| 226 | |
| 227 | if (zone >= asb->s_map_size) |
| 228 | goto bad_fragment; |
| 229 | |
| 230 | /* Convert sector offset to map offset */ |
| 231 | mapoff = signed_asl(offset, -asb->s_map2blk); |
| 232 | |
| 233 | read_lock(&adfs_map_lock); |
| 234 | result = scan_map(asb, zone, frag_id, mapoff); |
| 235 | read_unlock(&adfs_map_lock); |
| 236 | |
| 237 | if (result > 0) { |
| 238 | unsigned int secoff; |
| 239 | |
| 240 | /* Calculate sector offset into map block */ |
| 241 | secoff = offset - signed_asl(mapoff, asb->s_map2blk); |
| 242 | return secoff + signed_asl(result, asb->s_map2blk); |
| 243 | } |
| 244 | |
| 245 | adfs_error(sb, "fragment 0x%04x at offset %d not found in map", |
| 246 | frag_id, offset); |
| 247 | return 0; |
| 248 | |
| 249 | bad_fragment: |
| 250 | adfs_error(sb, "invalid fragment 0x%04x (zone = %d, max = %d)", |
| 251 | frag_id, zone, asb->s_map_size); |
| 252 | return 0; |
| 253 | } |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 254 | |
| 255 | static unsigned char adfs_calczonecheck(struct super_block *sb, unsigned char *map) |
| 256 | { |
| 257 | unsigned int v0, v1, v2, v3; |
| 258 | int i; |
| 259 | |
| 260 | v0 = v1 = v2 = v3 = 0; |
| 261 | for (i = sb->s_blocksize - 4; i; i -= 4) { |
| 262 | v0 += map[i] + (v3 >> 8); |
| 263 | v3 &= 0xff; |
| 264 | v1 += map[i + 1] + (v0 >> 8); |
| 265 | v0 &= 0xff; |
| 266 | v2 += map[i + 2] + (v1 >> 8); |
| 267 | v1 &= 0xff; |
| 268 | v3 += map[i + 3] + (v2 >> 8); |
| 269 | v2 &= 0xff; |
| 270 | } |
| 271 | v0 += v3 >> 8; |
| 272 | v1 += map[1] + (v0 >> 8); |
| 273 | v2 += map[2] + (v1 >> 8); |
| 274 | v3 += map[3] + (v2 >> 8); |
| 275 | |
| 276 | return v0 ^ v1 ^ v2 ^ v3; |
| 277 | } |
| 278 | |
| 279 | static int adfs_checkmap(struct super_block *sb, struct adfs_discmap *dm) |
| 280 | { |
| 281 | unsigned char crosscheck = 0, zonecheck = 1; |
| 282 | int i; |
| 283 | |
| 284 | for (i = 0; i < ADFS_SB(sb)->s_map_size; i++) { |
| 285 | unsigned char *map; |
| 286 | |
| 287 | map = dm[i].dm_bh->b_data; |
| 288 | |
| 289 | if (adfs_calczonecheck(sb, map) != map[0]) { |
| 290 | adfs_error(sb, "zone %d fails zonecheck", i); |
| 291 | zonecheck = 0; |
| 292 | } |
| 293 | crosscheck ^= map[3]; |
| 294 | } |
| 295 | if (crosscheck != 0xff) |
| 296 | adfs_error(sb, "crosscheck != 0xff"); |
| 297 | return crosscheck == 0xff && zonecheck; |
| 298 | } |
| 299 | |
Russell King | 6092b6b | 2019-12-09 11:08:39 +0000 | [diff] [blame] | 300 | /* |
| 301 | * Layout the map - the first zone contains a copy of the disc record, |
| 302 | * and the last zone must be limited to the size of the filesystem. |
| 303 | */ |
| 304 | static void adfs_map_layout(struct adfs_discmap *dm, unsigned int nzones, |
| 305 | struct adfs_discrecord *dr) |
| 306 | { |
| 307 | unsigned int zone, zone_size; |
| 308 | u64 size; |
| 309 | |
| 310 | zone_size = (8 << dr->log2secsize) - le16_to_cpu(dr->zone_spare); |
| 311 | |
| 312 | dm[0].dm_bh = NULL; |
| 313 | dm[0].dm_startblk = 0; |
Russell King | 197ba3c | 2019-12-09 11:08:49 +0000 | [diff] [blame] | 314 | dm[0].dm_startbit = 32 + ADFS_DR_SIZE_BITS; |
| 315 | dm[0].dm_endbit = 32 + zone_size; |
Russell King | 6092b6b | 2019-12-09 11:08:39 +0000 | [diff] [blame] | 316 | |
| 317 | for (zone = 1; zone < nzones; zone++) { |
| 318 | dm[zone].dm_bh = NULL; |
| 319 | dm[zone].dm_startblk = zone * zone_size - ADFS_DR_SIZE_BITS; |
Russell King | 197ba3c | 2019-12-09 11:08:49 +0000 | [diff] [blame] | 320 | dm[zone].dm_startbit = 32; |
| 321 | dm[zone].dm_endbit = 32 + zone_size; |
Russell King | 6092b6b | 2019-12-09 11:08:39 +0000 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | size = adfs_disc_size(dr) >> dr->log2bpmb; |
| 325 | size -= (nzones - 1) * zone_size - ADFS_DR_SIZE_BITS; |
Russell King | 197ba3c | 2019-12-09 11:08:49 +0000 | [diff] [blame] | 326 | dm[nzones - 1].dm_endbit = 32 + size; |
Russell King | 6092b6b | 2019-12-09 11:08:39 +0000 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | static int adfs_map_read(struct adfs_discmap *dm, struct super_block *sb, |
| 330 | unsigned int map_addr, unsigned int nzones) |
| 331 | { |
| 332 | unsigned int zone; |
| 333 | |
| 334 | for (zone = 0; zone < nzones; zone++) { |
| 335 | dm[zone].dm_bh = sb_bread(sb, map_addr + zone); |
| 336 | if (!dm[zone].dm_bh) |
| 337 | return -EIO; |
| 338 | } |
| 339 | |
| 340 | return 0; |
| 341 | } |
| 342 | |
| 343 | static void adfs_map_relse(struct adfs_discmap *dm, unsigned int nzones) |
| 344 | { |
| 345 | unsigned int zone; |
| 346 | |
| 347 | for (zone = 0; zone < nzones; zone++) |
| 348 | brelse(dm[zone].dm_bh); |
| 349 | } |
| 350 | |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 351 | struct adfs_discmap *adfs_read_map(struct super_block *sb, struct adfs_discrecord *dr) |
| 352 | { |
Russell King | 6092b6b | 2019-12-09 11:08:39 +0000 | [diff] [blame] | 353 | struct adfs_sb_info *asb = ADFS_SB(sb); |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 354 | struct adfs_discmap *dm; |
| 355 | unsigned int map_addr, zone_size, nzones; |
Russell King | 6092b6b | 2019-12-09 11:08:39 +0000 | [diff] [blame] | 356 | int ret; |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 357 | |
Russell King | f6f14a0 | 2019-12-09 11:08:59 +0000 | [diff] [blame^] | 358 | nzones = dr->nzones | dr->nzones_high << 8; |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 359 | zone_size = (8 << dr->log2secsize) - le16_to_cpu(dr->zone_spare); |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 360 | |
Russell King | f6f14a0 | 2019-12-09 11:08:59 +0000 | [diff] [blame^] | 361 | asb->s_idlen = dr->idlen; |
| 362 | asb->s_map_size = nzones; |
| 363 | asb->s_map2blk = dr->log2bpmb - dr->log2secsize; |
| 364 | asb->s_log2sharesize = dr->log2sharesize; |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 365 | asb->s_ids_per_zone = zone_size / (asb->s_idlen + 1); |
| 366 | |
Russell King | f6f14a0 | 2019-12-09 11:08:59 +0000 | [diff] [blame^] | 367 | map_addr = (nzones >> 1) * zone_size - |
| 368 | ((nzones > 1) ? ADFS_DR_SIZE_BITS : 0); |
| 369 | map_addr = signed_asl(map_addr, asb->s_map2blk); |
| 370 | |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 371 | dm = kmalloc_array(nzones, sizeof(*dm), GFP_KERNEL); |
| 372 | if (dm == NULL) { |
| 373 | adfs_error(sb, "not enough memory"); |
| 374 | return ERR_PTR(-ENOMEM); |
| 375 | } |
| 376 | |
Russell King | 6092b6b | 2019-12-09 11:08:39 +0000 | [diff] [blame] | 377 | adfs_map_layout(dm, nzones, dr); |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 378 | |
Russell King | 6092b6b | 2019-12-09 11:08:39 +0000 | [diff] [blame] | 379 | ret = adfs_map_read(dm, sb, map_addr, nzones); |
| 380 | if (ret) { |
| 381 | adfs_error(sb, "unable to read map"); |
| 382 | goto error_free; |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 383 | } |
| 384 | |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 385 | if (adfs_checkmap(sb, dm)) |
| 386 | return dm; |
| 387 | |
| 388 | adfs_error(sb, "map corrupted"); |
| 389 | |
| 390 | error_free: |
Russell King | 6092b6b | 2019-12-09 11:08:39 +0000 | [diff] [blame] | 391 | adfs_map_relse(dm, nzones); |
Russell King | f75d398 | 2019-12-09 11:08:28 +0000 | [diff] [blame] | 392 | kfree(dm); |
| 393 | return ERR_PTR(-EIO); |
| 394 | } |
Russell King | 7b19526 | 2019-12-09 11:08:44 +0000 | [diff] [blame] | 395 | |
| 396 | void adfs_free_map(struct super_block *sb) |
| 397 | { |
| 398 | struct adfs_sb_info *asb = ADFS_SB(sb); |
| 399 | |
| 400 | adfs_map_relse(asb->s_map, asb->s_map_size); |
| 401 | kfree(asb->s_map); |
| 402 | } |