Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/hfs/mdb.c |
| 3 | * |
| 4 | * Copyright (C) 1995-1997 Paul H. Hargrove |
| 5 | * (C) 2003 Ardis Technologies <roman@ardistech.com> |
| 6 | * This file may be distributed under the terms of the GNU General Public License. |
| 7 | * |
| 8 | * This file contains functions for reading/writing the MDB. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/cdrom.h> |
| 12 | #include <linux/genhd.h> |
Roman Zippel | 328b922 | 2005-09-06 15:18:49 -0700 | [diff] [blame] | 13 | #include <linux/nls.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 14 | #include <linux/slab.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
| 16 | #include "hfs_fs.h" |
| 17 | #include "btree.h" |
| 18 | |
| 19 | /*================ File-local data types ================*/ |
| 20 | |
| 21 | /* |
| 22 | * The HFS Master Directory Block (MDB). |
| 23 | * |
| 24 | * Also known as the Volume Information Block (VIB), this structure is |
| 25 | * the HFS equivalent of a superblock. |
| 26 | * |
| 27 | * Reference: _Inside Macintosh: Files_ pages 2-59 through 2-62 |
| 28 | * |
| 29 | * modified for HFS Extended |
| 30 | */ |
| 31 | |
| 32 | static int hfs_get_last_session(struct super_block *sb, |
| 33 | sector_t *start, sector_t *size) |
| 34 | { |
| 35 | struct cdrom_multisession ms_info; |
| 36 | struct cdrom_tocentry te; |
| 37 | int res; |
| 38 | |
| 39 | /* default values */ |
| 40 | *start = 0; |
| 41 | *size = sb->s_bdev->bd_inode->i_size >> 9; |
| 42 | |
| 43 | if (HFS_SB(sb)->session >= 0) { |
| 44 | te.cdte_track = HFS_SB(sb)->session; |
| 45 | te.cdte_format = CDROM_LBA; |
| 46 | res = ioctl_by_bdev(sb->s_bdev, CDROMREADTOCENTRY, (unsigned long)&te); |
| 47 | if (!res && (te.cdte_ctrl & CDROM_DATA_TRACK) == 4) { |
| 48 | *start = (sector_t)te.cdte_addr.lba << 2; |
| 49 | return 0; |
| 50 | } |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 51 | printk(KERN_ERR "hfs: invalid session number or type of track\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | return -EINVAL; |
| 53 | } |
| 54 | ms_info.addr_format = CDROM_LBA; |
| 55 | res = ioctl_by_bdev(sb->s_bdev, CDROMMULTISESSION, (unsigned long)&ms_info); |
| 56 | if (!res && ms_info.xa_flag) |
| 57 | *start = (sector_t)ms_info.addr.lba << 2; |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | /* |
| 62 | * hfs_mdb_get() |
| 63 | * |
| 64 | * Build the in-core MDB for a filesystem, including |
| 65 | * the B-trees and the volume bitmap. |
| 66 | */ |
| 67 | int hfs_mdb_get(struct super_block *sb) |
| 68 | { |
| 69 | struct buffer_head *bh; |
| 70 | struct hfs_mdb *mdb, *mdb2; |
| 71 | unsigned int block; |
| 72 | char *ptr; |
| 73 | int off2, len, size, sect; |
| 74 | sector_t part_start, part_size; |
| 75 | loff_t off; |
| 76 | __be16 attrib; |
| 77 | |
| 78 | /* set the device driver to 512-byte blocks */ |
| 79 | size = sb_min_blocksize(sb, HFS_SECTOR_SIZE); |
| 80 | if (!size) |
| 81 | return -EINVAL; |
| 82 | |
| 83 | if (hfs_get_last_session(sb, &part_start, &part_size)) |
| 84 | return -EINVAL; |
| 85 | while (1) { |
| 86 | /* See if this is an HFS filesystem */ |
| 87 | bh = sb_bread512(sb, part_start + HFS_MDB_BLK, mdb); |
| 88 | if (!bh) |
| 89 | goto out; |
| 90 | |
| 91 | if (mdb->drSigWord == cpu_to_be16(HFS_SUPER_MAGIC)) |
| 92 | break; |
| 93 | brelse(bh); |
| 94 | |
| 95 | /* check for a partition block |
| 96 | * (should do this only for cdrom/loop though) |
| 97 | */ |
| 98 | if (hfs_part_find(sb, &part_start, &part_size)) |
| 99 | goto out; |
| 100 | } |
| 101 | |
| 102 | HFS_SB(sb)->alloc_blksz = size = be32_to_cpu(mdb->drAlBlkSiz); |
| 103 | if (!size || (size & (HFS_SECTOR_SIZE - 1))) { |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 104 | printk(KERN_ERR "hfs: bad allocation block size %d\n", size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | goto out_bh; |
| 106 | } |
| 107 | |
| 108 | size = min(HFS_SB(sb)->alloc_blksz, (u32)PAGE_SIZE); |
| 109 | /* size must be a multiple of 512 */ |
| 110 | while (size & (size - 1)) |
| 111 | size -= HFS_SECTOR_SIZE; |
| 112 | sect = be16_to_cpu(mdb->drAlBlSt) + part_start; |
| 113 | /* align block size to first sector */ |
| 114 | while (sect & ((size - 1) >> HFS_SECTOR_SIZE_BITS)) |
| 115 | size >>= 1; |
| 116 | /* align block size to weird alloc size */ |
| 117 | while (HFS_SB(sb)->alloc_blksz & (size - 1)) |
| 118 | size >>= 1; |
| 119 | brelse(bh); |
| 120 | if (!sb_set_blocksize(sb, size)) { |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 121 | printk(KERN_ERR "hfs: unable to set blocksize to %u\n", size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | goto out; |
| 123 | } |
| 124 | |
| 125 | bh = sb_bread512(sb, part_start + HFS_MDB_BLK, mdb); |
| 126 | if (!bh) |
| 127 | goto out; |
| 128 | if (mdb->drSigWord != cpu_to_be16(HFS_SUPER_MAGIC)) |
| 129 | goto out_bh; |
| 130 | |
| 131 | HFS_SB(sb)->mdb_bh = bh; |
| 132 | HFS_SB(sb)->mdb = mdb; |
| 133 | |
| 134 | /* These parameters are read from the MDB, and never written */ |
| 135 | HFS_SB(sb)->part_start = part_start; |
| 136 | HFS_SB(sb)->fs_ablocks = be16_to_cpu(mdb->drNmAlBlks); |
| 137 | HFS_SB(sb)->fs_div = HFS_SB(sb)->alloc_blksz >> sb->s_blocksize_bits; |
| 138 | HFS_SB(sb)->clumpablks = be32_to_cpu(mdb->drClpSiz) / |
| 139 | HFS_SB(sb)->alloc_blksz; |
| 140 | if (!HFS_SB(sb)->clumpablks) |
| 141 | HFS_SB(sb)->clumpablks = 1; |
| 142 | HFS_SB(sb)->fs_start = (be16_to_cpu(mdb->drAlBlSt) + part_start) >> |
| 143 | (sb->s_blocksize_bits - HFS_SECTOR_SIZE_BITS); |
| 144 | |
| 145 | /* These parameters are read from and written to the MDB */ |
| 146 | HFS_SB(sb)->free_ablocks = be16_to_cpu(mdb->drFreeBks); |
| 147 | HFS_SB(sb)->next_id = be32_to_cpu(mdb->drNxtCNID); |
| 148 | HFS_SB(sb)->root_files = be16_to_cpu(mdb->drNmFls); |
| 149 | HFS_SB(sb)->root_dirs = be16_to_cpu(mdb->drNmRtDirs); |
| 150 | HFS_SB(sb)->file_count = be32_to_cpu(mdb->drFilCnt); |
| 151 | HFS_SB(sb)->folder_count = be32_to_cpu(mdb->drDirCnt); |
| 152 | |
| 153 | /* TRY to get the alternate (backup) MDB. */ |
| 154 | sect = part_start + part_size - 2; |
| 155 | bh = sb_bread512(sb, sect, mdb2); |
| 156 | if (bh) { |
| 157 | if (mdb2->drSigWord == cpu_to_be16(HFS_SUPER_MAGIC)) { |
| 158 | HFS_SB(sb)->alt_mdb_bh = bh; |
| 159 | HFS_SB(sb)->alt_mdb = mdb2; |
| 160 | } else |
| 161 | brelse(bh); |
| 162 | } |
| 163 | |
| 164 | if (!HFS_SB(sb)->alt_mdb) { |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 165 | printk(KERN_WARNING "hfs: unable to locate alternate MDB\n"); |
| 166 | printk(KERN_WARNING "hfs: continuing without an alternate MDB\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | HFS_SB(sb)->bitmap = (__be32 *)__get_free_pages(GFP_KERNEL, PAGE_SIZE < 8192 ? 1 : 0); |
| 170 | if (!HFS_SB(sb)->bitmap) |
| 171 | goto out; |
| 172 | |
| 173 | /* read in the bitmap */ |
| 174 | block = be16_to_cpu(mdb->drVBMSt) + part_start; |
| 175 | off = (loff_t)block << HFS_SECTOR_SIZE_BITS; |
| 176 | size = (HFS_SB(sb)->fs_ablocks + 8) / 8; |
| 177 | ptr = (u8 *)HFS_SB(sb)->bitmap; |
| 178 | while (size) { |
| 179 | bh = sb_bread(sb, off >> sb->s_blocksize_bits); |
| 180 | if (!bh) { |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 181 | printk(KERN_ERR "hfs: unable to read volume bitmap\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | goto out; |
| 183 | } |
| 184 | off2 = off & (sb->s_blocksize - 1); |
| 185 | len = min((int)sb->s_blocksize - off2, size); |
| 186 | memcpy(ptr, bh->b_data + off2, len); |
| 187 | brelse(bh); |
| 188 | ptr += len; |
| 189 | off += len; |
| 190 | size -= len; |
| 191 | } |
| 192 | |
| 193 | HFS_SB(sb)->ext_tree = hfs_btree_open(sb, HFS_EXT_CNID, hfs_ext_keycmp); |
| 194 | if (!HFS_SB(sb)->ext_tree) { |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 195 | printk(KERN_ERR "hfs: unable to open extent tree\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | goto out; |
| 197 | } |
| 198 | HFS_SB(sb)->cat_tree = hfs_btree_open(sb, HFS_CAT_CNID, hfs_cat_keycmp); |
| 199 | if (!HFS_SB(sb)->cat_tree) { |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 200 | printk(KERN_ERR "hfs: unable to open catalog tree\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | goto out; |
| 202 | } |
| 203 | |
| 204 | attrib = mdb->drAtrb; |
| 205 | if (!(attrib & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) { |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 206 | printk(KERN_WARNING "hfs: filesystem was not cleanly unmounted, " |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | "running fsck.hfs is recommended. mounting read-only.\n"); |
| 208 | sb->s_flags |= MS_RDONLY; |
| 209 | } |
| 210 | if ((attrib & cpu_to_be16(HFS_SB_ATTRIB_SLOCK))) { |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 211 | printk(KERN_WARNING "hfs: filesystem is marked locked, mounting read-only.\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | sb->s_flags |= MS_RDONLY; |
| 213 | } |
| 214 | if (!(sb->s_flags & MS_RDONLY)) { |
| 215 | /* Mark the volume uncleanly unmounted in case we crash */ |
| 216 | attrib &= cpu_to_be16(~HFS_SB_ATTRIB_UNMNT); |
| 217 | attrib |= cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT); |
| 218 | mdb->drAtrb = attrib; |
Marcin Slusarz | 20c79e7 | 2008-04-30 00:54:47 -0700 | [diff] [blame] | 219 | be32_add_cpu(&mdb->drWrCnt, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | mdb->drLsMod = hfs_mtime(); |
| 221 | |
| 222 | mark_buffer_dirty(HFS_SB(sb)->mdb_bh); |
Christoph Hellwig | 3072b90 | 2010-10-06 10:49:17 +0200 | [diff] [blame] | 223 | sync_dirty_buffer(HFS_SB(sb)->mdb_bh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | return 0; |
| 227 | |
| 228 | out_bh: |
| 229 | brelse(bh); |
| 230 | out: |
| 231 | hfs_mdb_put(sb); |
| 232 | return -EIO; |
| 233 | } |
| 234 | |
| 235 | /* |
| 236 | * hfs_mdb_commit() |
| 237 | * |
| 238 | * Description: |
Artem Bityutskiy | 50640bc | 2012-07-25 18:12:09 +0300 | [diff] [blame] | 239 | * This updates the MDB on disk. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | * It does not check, if the superblock has been modified, or |
| 241 | * if the filesystem has been mounted read-only. It is mainly |
Artem Bityutskiy | 50640bc | 2012-07-25 18:12:09 +0300 | [diff] [blame] | 242 | * called by hfs_sync_fs() and flush_mdb(). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | * Input Variable(s): |
| 244 | * struct hfs_mdb *mdb: Pointer to the hfs MDB |
| 245 | * int backup; |
| 246 | * Output Variable(s): |
| 247 | * NONE |
| 248 | * Returns: |
| 249 | * void |
| 250 | * Preconditions: |
| 251 | * 'mdb' points to a "valid" (struct hfs_mdb). |
| 252 | * Postconditions: |
| 253 | * The HFS MDB and on disk will be updated, by copying the possibly |
| 254 | * modified fields from the in memory MDB (in native byte order) to |
| 255 | * the disk block buffer. |
| 256 | * If 'backup' is non-zero then the alternate MDB is also written |
| 257 | * and the function doesn't return until it is actually on disk. |
| 258 | */ |
| 259 | void hfs_mdb_commit(struct super_block *sb) |
| 260 | { |
| 261 | struct hfs_mdb *mdb = HFS_SB(sb)->mdb; |
| 262 | |
Artem Bityutskiy | 4527440 | 2012-07-12 17:28:47 +0300 | [diff] [blame] | 263 | if (sb->s_flags & MS_RDONLY) |
| 264 | return; |
| 265 | |
Artem Bityutskiy | b593523 | 2012-07-12 17:28:45 +0300 | [diff] [blame] | 266 | lock_buffer(HFS_SB(sb)->mdb_bh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | if (test_and_clear_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags)) { |
| 268 | /* These parameters may have been modified, so write them back */ |
| 269 | mdb->drLsMod = hfs_mtime(); |
| 270 | mdb->drFreeBks = cpu_to_be16(HFS_SB(sb)->free_ablocks); |
| 271 | mdb->drNxtCNID = cpu_to_be32(HFS_SB(sb)->next_id); |
| 272 | mdb->drNmFls = cpu_to_be16(HFS_SB(sb)->root_files); |
| 273 | mdb->drNmRtDirs = cpu_to_be16(HFS_SB(sb)->root_dirs); |
| 274 | mdb->drFilCnt = cpu_to_be32(HFS_SB(sb)->file_count); |
| 275 | mdb->drDirCnt = cpu_to_be32(HFS_SB(sb)->folder_count); |
| 276 | |
| 277 | /* write MDB to disk */ |
| 278 | mark_buffer_dirty(HFS_SB(sb)->mdb_bh); |
| 279 | } |
| 280 | |
| 281 | /* write the backup MDB, not returning until it is written. |
| 282 | * we only do this when either the catalog or extents overflow |
| 283 | * files grow. */ |
| 284 | if (test_and_clear_bit(HFS_FLG_ALT_MDB_DIRTY, &HFS_SB(sb)->flags) && |
| 285 | HFS_SB(sb)->alt_mdb) { |
| 286 | hfs_inode_write_fork(HFS_SB(sb)->ext_tree->inode, mdb->drXTExtRec, |
| 287 | &mdb->drXTFlSize, NULL); |
| 288 | hfs_inode_write_fork(HFS_SB(sb)->cat_tree->inode, mdb->drCTExtRec, |
| 289 | &mdb->drCTFlSize, NULL); |
Artem Bityutskiy | b593523 | 2012-07-12 17:28:45 +0300 | [diff] [blame] | 290 | |
| 291 | lock_buffer(HFS_SB(sb)->alt_mdb_bh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | memcpy(HFS_SB(sb)->alt_mdb, HFS_SB(sb)->mdb, HFS_SECTOR_SIZE); |
| 293 | HFS_SB(sb)->alt_mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT); |
| 294 | HFS_SB(sb)->alt_mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT); |
Artem Bityutskiy | b593523 | 2012-07-12 17:28:45 +0300 | [diff] [blame] | 295 | unlock_buffer(HFS_SB(sb)->alt_mdb_bh); |
| 296 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | mark_buffer_dirty(HFS_SB(sb)->alt_mdb_bh); |
Christoph Hellwig | 3072b90 | 2010-10-06 10:49:17 +0200 | [diff] [blame] | 298 | sync_dirty_buffer(HFS_SB(sb)->alt_mdb_bh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | if (test_and_clear_bit(HFS_FLG_BITMAP_DIRTY, &HFS_SB(sb)->flags)) { |
| 302 | struct buffer_head *bh; |
| 303 | sector_t block; |
| 304 | char *ptr; |
| 305 | int off, size, len; |
| 306 | |
| 307 | block = be16_to_cpu(HFS_SB(sb)->mdb->drVBMSt) + HFS_SB(sb)->part_start; |
| 308 | off = (block << HFS_SECTOR_SIZE_BITS) & (sb->s_blocksize - 1); |
| 309 | block >>= sb->s_blocksize_bits - HFS_SECTOR_SIZE_BITS; |
| 310 | size = (HFS_SB(sb)->fs_ablocks + 7) / 8; |
| 311 | ptr = (u8 *)HFS_SB(sb)->bitmap; |
| 312 | while (size) { |
| 313 | bh = sb_bread(sb, block); |
| 314 | if (!bh) { |
Roman Zippel | 7cf3cc3 | 2006-01-18 17:43:07 -0800 | [diff] [blame] | 315 | printk(KERN_ERR "hfs: unable to read volume bitmap\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | break; |
| 317 | } |
| 318 | len = min((int)sb->s_blocksize - off, size); |
Artem Bityutskiy | b593523 | 2012-07-12 17:28:45 +0300 | [diff] [blame] | 319 | |
| 320 | lock_buffer(bh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | memcpy(bh->b_data + off, ptr, len); |
Artem Bityutskiy | b593523 | 2012-07-12 17:28:45 +0300 | [diff] [blame] | 322 | unlock_buffer(bh); |
| 323 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | mark_buffer_dirty(bh); |
| 325 | brelse(bh); |
| 326 | block++; |
| 327 | off = 0; |
| 328 | ptr += len; |
| 329 | size -= len; |
| 330 | } |
| 331 | } |
Artem Bityutskiy | b593523 | 2012-07-12 17:28:45 +0300 | [diff] [blame] | 332 | unlock_buffer(HFS_SB(sb)->mdb_bh); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | } |
| 334 | |
| 335 | void hfs_mdb_close(struct super_block *sb) |
| 336 | { |
| 337 | /* update volume attributes */ |
| 338 | if (sb->s_flags & MS_RDONLY) |
| 339 | return; |
| 340 | HFS_SB(sb)->mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT); |
| 341 | HFS_SB(sb)->mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT); |
| 342 | mark_buffer_dirty(HFS_SB(sb)->mdb_bh); |
| 343 | } |
| 344 | |
| 345 | /* |
| 346 | * hfs_mdb_put() |
| 347 | * |
| 348 | * Release the resources associated with the in-core MDB. */ |
| 349 | void hfs_mdb_put(struct super_block *sb) |
| 350 | { |
Colin Leroy | 945b092 | 2005-05-01 08:59:16 -0700 | [diff] [blame] | 351 | if (!HFS_SB(sb)) |
| 352 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | /* free the B-trees */ |
| 354 | hfs_btree_close(HFS_SB(sb)->ext_tree); |
| 355 | hfs_btree_close(HFS_SB(sb)->cat_tree); |
| 356 | |
| 357 | /* free the buffers holding the primary and alternate MDBs */ |
| 358 | brelse(HFS_SB(sb)->mdb_bh); |
| 359 | brelse(HFS_SB(sb)->alt_mdb_bh); |
Colin Leroy | 945b092 | 2005-05-01 08:59:16 -0700 | [diff] [blame] | 360 | |
Thomas Gleixner | 6d729e4 | 2009-08-16 21:05:08 +0000 | [diff] [blame] | 361 | unload_nls(HFS_SB(sb)->nls_io); |
| 362 | unload_nls(HFS_SB(sb)->nls_disk); |
Roman Zippel | 328b922 | 2005-09-06 15:18:49 -0700 | [diff] [blame] | 363 | |
Dave Anderson | eb2e5f4 | 2009-04-13 14:39:46 -0700 | [diff] [blame] | 364 | free_pages((unsigned long)HFS_SB(sb)->bitmap, PAGE_SIZE < 8192 ? 1 : 0); |
Colin Leroy | 945b092 | 2005-05-01 08:59:16 -0700 | [diff] [blame] | 365 | kfree(HFS_SB(sb)); |
| 366 | sb->s_fs_info = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | } |