aboutsummaryrefslogtreecommitdiffstats
path: root/fs/squashfs
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@lougher.demon.co.uk>2011-05-23 21:57:05 -0400
committerPhillip Lougher <phillip@lougher.demon.co.uk>2011-05-25 13:21:31 -0400
commit76e002f755b61aa79228f4e751bbca8674aba0f6 (patch)
tree9f0ff663ffddd2e4a9d0c5f20a350ee3824485d7 /fs/squashfs
parent82de647e1f81fd89afc48608d889dd3b33cb8983 (diff)
Squashfs: reverse order of filesystem table reading
Reverse order of table reading from mostly first to last in placement order, to last to first. This is to enable extra superblock sanity checks to be added in later patches. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
Diffstat (limited to 'fs/squashfs')
-rw-r--r--fs/squashfs/super.c71
1 files changed, 37 insertions, 34 deletions
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index d16c39263f39..401cc8c7608f 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -214,6 +214,24 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
214 goto failed_mount; 214 goto failed_mount;
215 } 215 }
216 216
217 /* Handle xattrs */
218 sb->s_xattr = squashfs_xattr_handlers;
219 xattr_id_table_start = le64_to_cpu(sblk->xattr_id_table_start);
220 if (xattr_id_table_start == SQUASHFS_INVALID_BLK)
221 goto allocate_id_index_table;
222
223 /* Allocate and read xattr id lookup table */
224 msblk->xattr_id_table = squashfs_read_xattr_id_table(sb,
225 xattr_id_table_start, &msblk->xattr_table, &msblk->xattr_ids);
226 if (IS_ERR(msblk->xattr_id_table)) {
227 ERROR("unable to read xattr id index table\n");
228 err = PTR_ERR(msblk->xattr_id_table);
229 msblk->xattr_id_table = NULL;
230 if (err != -ENOTSUPP)
231 goto failed_mount;
232 }
233
234allocate_id_index_table:
217 /* Allocate and read id index table */ 235 /* Allocate and read id index table */
218 msblk->id_table = squashfs_read_id_index_table(sb, 236 msblk->id_table = squashfs_read_id_index_table(sb,
219 le64_to_cpu(sblk->id_table_start), le16_to_cpu(sblk->no_ids)); 237 le64_to_cpu(sblk->id_table_start), le16_to_cpu(sblk->no_ids));
@@ -224,9 +242,27 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
224 goto failed_mount; 242 goto failed_mount;
225 } 243 }
226 244
245 /* Handle inode lookup table */
246 lookup_table_start = le64_to_cpu(sblk->lookup_table_start);
247 if (lookup_table_start == SQUASHFS_INVALID_BLK)
248 goto handle_fragments;
249
250 /* Allocate and read inode lookup table */
251 msblk->inode_lookup_table = squashfs_read_inode_lookup_table(sb,
252 lookup_table_start, msblk->inodes);
253 if (IS_ERR(msblk->inode_lookup_table)) {
254 ERROR("unable to read inode lookup table\n");
255 err = PTR_ERR(msblk->inode_lookup_table);
256 msblk->inode_lookup_table = NULL;
257 goto failed_mount;
258 }
259
260 sb->s_export_op = &squashfs_export_ops;
261
262handle_fragments:
227 fragments = le32_to_cpu(sblk->fragments); 263 fragments = le32_to_cpu(sblk->fragments);
228 if (fragments == 0) 264 if (fragments == 0)
229 goto allocate_lookup_table; 265 goto allocate_root;
230 266
231 msblk->fragment_cache = squashfs_cache_init("fragment", 267 msblk->fragment_cache = squashfs_cache_init("fragment",
232 SQUASHFS_CACHED_FRAGMENTS, msblk->block_size); 268 SQUASHFS_CACHED_FRAGMENTS, msblk->block_size);
@@ -245,39 +281,6 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
245 goto failed_mount; 281 goto failed_mount;
246 } 282 }
247 283
248allocate_lookup_table:
249 lookup_table_start = le64_to_cpu(sblk->lookup_table_start);
250 if (lookup_table_start == SQUASHFS_INVALID_BLK)
251 goto allocate_xattr_table;
252
253 /* Allocate and read inode lookup table */
254 msblk->inode_lookup_table = squashfs_read_inode_lookup_table(sb,
255 lookup_table_start, msblk->inodes);
256 if (IS_ERR(msblk->inode_lookup_table)) {
257 ERROR("unable to read inode lookup table\n");
258 err = PTR_ERR(msblk->inode_lookup_table);
259 msblk->inode_lookup_table = NULL;
260 goto failed_mount;
261 }
262
263 sb->s_export_op = &squashfs_export_ops;
264
265allocate_xattr_table:
266 sb->s_xattr = squashfs_xattr_handlers;
267 xattr_id_table_start = le64_to_cpu(sblk->xattr_id_table_start);
268 if (xattr_id_table_start == SQUASHFS_INVALID_BLK)
269 goto allocate_root;
270
271 /* Allocate and read xattr id lookup table */
272 msblk->xattr_id_table = squashfs_read_xattr_id_table(sb,
273 xattr_id_table_start, &msblk->xattr_table, &msblk->xattr_ids);
274 if (IS_ERR(msblk->xattr_id_table)) {
275 ERROR("unable to read xattr id index table\n");
276 err = PTR_ERR(msblk->xattr_id_table);
277 msblk->xattr_id_table = NULL;
278 if (err != -ENOTSUPP)
279 goto failed_mount;
280 }
281allocate_root: 284allocate_root:
282 root = new_inode(sb); 285 root = new_inode(sb);
283 if (!root) { 286 if (!root) {