Lines Matching +full:rcu +full:- +full:endian +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0-only
9 * 01-02-2012 by Kai Bankett (chaosman@ontika.net) : first release.
10 * 16-02-2012 pagemap extension by Al Viro
49 struct super_block *sb = root->d_sb; in qnx6_show_options()
52 if (sbi->s_mount_opt & QNX6_MOUNT_MMI_FS) in qnx6_show_options()
67 return fs32_to_cpu(sbi, block) + sbi->s_blks_off; in qnx6_get_devblock()
78 inode->i_ino, (unsigned long)iblock); in qnx6_get_block()
83 map_bh(bh, inode->i_sb, phys); in qnx6_get_block()
108 * returns the block number for the no-th element in the tree
113 struct super_block *s = inode->i_sb; in qnx6_block_map()
120 int ptrbits = sbi->s_ptrbits; in qnx6_block_map()
122 u32 mask = (1 << ptrbits) - 1; in qnx6_block_map()
123 int depth = ei->di_filelevels; in qnx6_block_map()
129 if (levelptr > QNX6_NO_DIRECT_POINTERS - 1) { in qnx6_block_map()
134 block = qnx6_get_devblock(s, ei->di_block_ptr[levelptr]); in qnx6_block_map()
142 bitdelta -= ptrbits; in qnx6_block_map()
144 ptr = ((__fs32 *)bh->b_data)[levelptr]; in qnx6_block_map()
157 struct super_block *sb = dentry->d_sb; in qnx6_statfs()
159 u64 id = huge_encode_dev(sb->s_bdev->bd_dev); in qnx6_statfs()
161 buf->f_type = sb->s_magic; in qnx6_statfs()
162 buf->f_bsize = sb->s_blocksize; in qnx6_statfs()
163 buf->f_blocks = fs32_to_cpu(sbi, sbi->sb->sb_num_blocks); in qnx6_statfs()
164 buf->f_bfree = fs32_to_cpu(sbi, sbi->sb->sb_free_blocks); in qnx6_statfs()
165 buf->f_files = fs32_to_cpu(sbi, sbi->sb->sb_num_inodes); in qnx6_statfs()
166 buf->f_ffree = fs32_to_cpu(sbi, sbi->sb->sb_free_inodes); in qnx6_statfs()
167 buf->f_bavail = buf->f_bfree; in qnx6_statfs()
168 buf->f_namelen = QNX6_LONG_NAME_MAX; in qnx6_statfs()
169 buf->f_fsid = u64_to_fsid(id); in qnx6_statfs()
184 struct inode *root = d_inode(s->s_root); in qnx6_checkroot()
185 struct address_space *mapping = root->i_mapping; in qnx6_checkroot()
192 /* maximum 3 bytes - due to match_root limitation */ in qnx6_checkroot()
207 pr_debug("magic: %08x\n", fs32_to_cpu(sbi, sb->sb_magic)); in qnx6_superblock_debug()
208 pr_debug("checksum: %08x\n", fs32_to_cpu(sbi, sb->sb_checksum)); in qnx6_superblock_debug()
209 pr_debug("serial: %llx\n", fs64_to_cpu(sbi, sb->sb_serial)); in qnx6_superblock_debug()
210 pr_debug("flags: %08x\n", fs32_to_cpu(sbi, sb->sb_flags)); in qnx6_superblock_debug()
211 pr_debug("blocksize: %08x\n", fs32_to_cpu(sbi, sb->sb_blocksize)); in qnx6_superblock_debug()
212 pr_debug("num_inodes: %08x\n", fs32_to_cpu(sbi, sb->sb_num_inodes)); in qnx6_superblock_debug()
213 pr_debug("free_inodes: %08x\n", fs32_to_cpu(sbi, sb->sb_free_inodes)); in qnx6_superblock_debug()
214 pr_debug("num_blocks: %08x\n", fs32_to_cpu(sbi, sb->sb_num_blocks)); in qnx6_superblock_debug()
215 pr_debug("free_blocks: %08x\n", fs32_to_cpu(sbi, sb->sb_free_blocks)); in qnx6_superblock_debug()
216 pr_debug("inode_levels: %02x\n", sb->Inode.levels); in qnx6_superblock_debug()
247 set_opt(sbi->s_mount_opt, MMI_FS); in qnx6_parse_options()
257 int offset, int silent) in qnx6_check_first_superblock() argument
265 bh = sb_bread(s, offset); in qnx6_check_first_superblock()
270 sb = (struct qnx6_super_block *)bh->b_data; in qnx6_check_first_superblock()
271 if (fs32_to_cpu(sbi, sb->sb_magic) != QNX6_SUPER_MAGIC) { in qnx6_check_first_superblock()
272 sbi->s_bytesex = BYTESEX_BE; in qnx6_check_first_superblock()
273 if (fs32_to_cpu(sbi, sb->sb_magic) == QNX6_SUPER_MAGIC) { in qnx6_check_first_superblock()
274 /* we got a big endian fs */ in qnx6_check_first_superblock()
278 sbi->s_bytesex = BYTESEX_LE; in qnx6_check_first_superblock()
280 if (offset == 0) { in qnx6_check_first_superblock()
283 … pr_info("wrong signature (magic) at position (0x%lx) - will try alternative position (0x0000).\n", in qnx6_check_first_superblock()
284 offset * s->s_blocksize); in qnx6_check_first_superblock()
304 int ret = -EINVAL; in qnx6_fill_super()
305 u64 offset; in qnx6_fill_super() local
310 return -ENOMEM; in qnx6_fill_super()
311 s->s_fs_info = qs; in qnx6_fill_super()
319 /* parse the mount-options */ in qnx6_fill_super()
332 sbi->s_bytesex = BYTESEX_LE; in qnx6_fill_super()
338 /* try again without bootblock offset */ in qnx6_fill_super()
347 sb1 = (struct qnx6_super_block *)bh1->b_data; in qnx6_fill_super()
353 /* checksum check - start at byte 8 and end at byte 512 */ in qnx6_fill_super()
354 if (fs32_to_cpu(sbi, sb1->sb_checksum) != in qnx6_fill_super()
355 crc32_be(0, (char *)(bh1->b_data + 8), 504)) { in qnx6_fill_super()
361 if (!sb_set_blocksize(s, fs32_to_cpu(sbi, sb1->sb_blocksize))) { in qnx6_fill_super()
365 /* blocksize invalidates bh - pull it back in */ in qnx6_fill_super()
367 bh1 = sb_bread(s, bootblock_offset >> s->s_blocksize_bits); in qnx6_fill_super()
370 sb1 = (struct qnx6_super_block *)bh1->b_data; in qnx6_fill_super()
373 offset = fs32_to_cpu(sbi, sb1->sb_num_blocks) + in qnx6_fill_super()
374 (bootblock_offset >> s->s_blocksize_bits) + in qnx6_fill_super()
375 (QNX6_SUPERBLOCK_AREA >> s->s_blocksize_bits); in qnx6_fill_super()
377 /* set bootblock offset */ in qnx6_fill_super()
378 sbi->s_blks_off = (bootblock_offset >> s->s_blocksize_bits) + in qnx6_fill_super()
379 (QNX6_SUPERBLOCK_AREA >> s->s_blocksize_bits); in qnx6_fill_super()
382 bh2 = sb_bread(s, offset); in qnx6_fill_super()
387 sb2 = (struct qnx6_super_block *)bh2->b_data; in qnx6_fill_super()
388 if (fs32_to_cpu(sbi, sb2->sb_magic) != QNX6_SUPER_MAGIC) { in qnx6_fill_super()
394 /* checksum check - start at byte 8 and end at byte 512 */ in qnx6_fill_super()
395 if (fs32_to_cpu(sbi, sb2->sb_checksum) != in qnx6_fill_super()
396 crc32_be(0, (char *)(bh2->b_data + 8), 504)) { in qnx6_fill_super()
401 if (fs64_to_cpu(sbi, sb1->sb_serial) >= in qnx6_fill_super()
402 fs64_to_cpu(sbi, sb2->sb_serial)) { in qnx6_fill_super()
404 sbi->sb_buf = bh1; in qnx6_fill_super()
405 sbi->sb = (struct qnx6_super_block *)bh1->b_data; in qnx6_fill_super()
410 sbi->sb_buf = bh2; in qnx6_fill_super()
411 sbi->sb = (struct qnx6_super_block *)bh2->b_data; in qnx6_fill_super()
416 /* sanity check - limit maximum indirect pointer levels */ in qnx6_fill_super()
417 if (sb1->Inode.levels > QNX6_PTR_MAX_LEVELS) { in qnx6_fill_super()
419 QNX6_PTR_MAX_LEVELS, sb1->Inode.levels); in qnx6_fill_super()
422 if (sb1->Longfile.levels > QNX6_PTR_MAX_LEVELS) { in qnx6_fill_super()
424 QNX6_PTR_MAX_LEVELS, sb1->Longfile.levels); in qnx6_fill_super()
427 s->s_op = &qnx6_sops; in qnx6_fill_super()
428 s->s_magic = QNX6_SUPER_MAGIC; in qnx6_fill_super()
429 s->s_flags |= SB_RDONLY; /* Yup, read-only yet */ in qnx6_fill_super()
430 s->s_time_min = 0; in qnx6_fill_super()
431 s->s_time_max = U32_MAX; in qnx6_fill_super()
435 sbi->s_ptrbits = ilog2(s->s_blocksize / 4); in qnx6_fill_super()
436 sbi->inodes = qnx6_private_inode(s, &sb1->Inode); in qnx6_fill_super()
437 if (!sbi->inodes) in qnx6_fill_super()
439 sbi->longfile = qnx6_private_inode(s, &sb1->Longfile); in qnx6_fill_super()
440 if (!sbi->longfile) in qnx6_fill_super()
451 ret = -ENOMEM; in qnx6_fill_super()
452 s->s_root = d_make_root(root); in qnx6_fill_super()
453 if (!s->s_root) in qnx6_fill_super()
456 ret = -EINVAL; in qnx6_fill_super()
466 dput(s->s_root); in qnx6_fill_super()
467 s->s_root = NULL; in qnx6_fill_super()
469 iput(sbi->longfile); in qnx6_fill_super()
471 iput(sbi->inodes); in qnx6_fill_super()
477 s->s_fs_info = NULL; in qnx6_fill_super()
484 brelse(qs->sb_buf); in qnx6_put_super()
485 iput(qs->longfile); in qnx6_put_super()
486 iput(qs->inodes); in qnx6_put_super()
488 sb->s_fs_info = NULL; in qnx6_put_super()
509 inode->i_size = fs64_to_cpu(sbi, p->size); in qnx6_private_inode()
510 memcpy(ei->di_block_ptr, p->ptr, sizeof(p->ptr)); in qnx6_private_inode()
511 ei->di_filelevels = p->levels; in qnx6_private_inode()
512 inode->i_mode = S_IFREG | S_IRUSR; /* probably wrong */ in qnx6_private_inode()
513 inode->i_mapping->a_ops = &qnx6_aops; in qnx6_private_inode()
530 return ERR_PTR(-ENOMEM); in qnx6_iget()
531 if (!(inode->i_state & I_NEW)) in qnx6_iget()
536 inode->i_mode = 0; in qnx6_iget()
540 sb->s_id, ino); in qnx6_iget()
542 return ERR_PTR(-EIO); in qnx6_iget()
544 n = (ino - 1) >> (PAGE_SHIFT - QNX6_INODE_SIZE_BITS); in qnx6_iget()
545 offs = (ino - 1) & (~PAGE_MASK >> QNX6_INODE_SIZE_BITS); in qnx6_iget()
546 mapping = sbi->inodes->i_mapping; in qnx6_iget()
550 sb->s_id); in qnx6_iget()
557 inode->i_mode = fs16_to_cpu(sbi, raw_inode->di_mode); in qnx6_iget()
558 i_uid_write(inode, (uid_t)fs32_to_cpu(sbi, raw_inode->di_uid)); in qnx6_iget()
559 i_gid_write(inode, (gid_t)fs32_to_cpu(sbi, raw_inode->di_gid)); in qnx6_iget()
560 inode->i_size = fs64_to_cpu(sbi, raw_inode->di_size); in qnx6_iget()
561 inode->i_mtime.tv_sec = fs32_to_cpu(sbi, raw_inode->di_mtime); in qnx6_iget()
562 inode->i_mtime.tv_nsec = 0; in qnx6_iget()
563 inode->i_atime.tv_sec = fs32_to_cpu(sbi, raw_inode->di_atime); in qnx6_iget()
564 inode->i_atime.tv_nsec = 0; in qnx6_iget()
565 inode_set_ctime(inode, fs32_to_cpu(sbi, raw_inode->di_ctime), 0); in qnx6_iget()
568 inode->i_blocks = (inode->i_size + 511) >> 9; in qnx6_iget()
570 memcpy(&ei->di_block_ptr, &raw_inode->di_block_ptr, in qnx6_iget()
571 sizeof(raw_inode->di_block_ptr)); in qnx6_iget()
572 ei->di_filelevels = raw_inode->di_filelevels; in qnx6_iget()
574 if (S_ISREG(inode->i_mode)) { in qnx6_iget()
575 inode->i_fop = &generic_ro_fops; in qnx6_iget()
576 inode->i_mapping->a_ops = &qnx6_aops; in qnx6_iget()
577 } else if (S_ISDIR(inode->i_mode)) { in qnx6_iget()
578 inode->i_op = &qnx6_dir_inode_operations; in qnx6_iget()
579 inode->i_fop = &qnx6_dir_operations; in qnx6_iget()
580 inode->i_mapping->a_ops = &qnx6_aops; in qnx6_iget()
581 } else if (S_ISLNK(inode->i_mode)) { in qnx6_iget()
582 inode->i_op = &page_symlink_inode_operations; in qnx6_iget()
584 inode->i_mapping->a_ops = &qnx6_aops; in qnx6_iget()
586 init_special_inode(inode, inode->i_mode, 0); in qnx6_iget()
600 return &ei->vfs_inode; in qnx6_alloc_inode()
612 inode_init_once(&ei->vfs_inode); in init_once()
623 return -ENOMEM; in init_inodecache()
630 * Make sure all delayed rcu free inodes are flushed before we in destroy_inodecache()