27 #include <linux/time.h>
28 #include <linux/stat.h>
29 #include <linux/string.h>
31 #include <linux/sched.h>
32 #include <linux/bitops.h>
33 #include <asm/byteorder.h>
69 uspi = UFS_SB(sb)->s_uspi;
76 if (!((ino > 1) && (ino < (uspi->
s_ncg * uspi->
s_ipg )))) {
77 ufs_warning(sb,
"ufs_free_inode",
"reserved inode or nonexistent inode %u\n", ino);
91 ufs_panic (sb,
"ufs_free_fragments",
"internal error, bad cg magic number");
98 ufs_error(sb,
"ufs_free_inode",
"bit already cleared for inode %u", ino);
101 if (ino < ucpi->c_irotor)
103 fs32_add(sb, &ucg->
cg_cs.cs_nifree, 1);
108 fs32_sub(sb, &ucg->
cg_cs.cs_ndir, 1);
110 fs32_sub(sb, &UFS_SB(sb)->
fs_cs(cg).cs_ndir, 1);
134 struct buffer_head *bh;
138 fs32_to_cpu(sb, ucg->
cg_u.
cg_u2.cg_initediblk));
143 for (; beg <
end; ++beg) {
144 bh = sb_getblk(sb, beg);
147 set_buffer_uptodate(bh);
190 return ERR_PTR(-
EPERM);
206 if (sbi->fs_cs(i).cs_nifree) {
214 for ( j = 1; j < uspi->
s_ncg; j <<= 1 ) {
216 if (i >= uspi->
s_ncg)
218 if (sbi->fs_cs(i).cs_nifree) {
228 for (j = 2; j < uspi->
s_ncg; j++) {
230 if (i >= uspi->
s_ncg)
232 if (sbi->fs_cs(i).cs_nifree) {
248 ufs_panic (sb,
"ufs_new_inode",
"internal error, bad cg magic number");
252 if (!(bit < uspi->s_ipg)) {
254 if (!(bit < start)) {
256 "cylinder group %u corrupted - error in inode bitmap\n", cg);
261 UFSD(
"start = %u, bit = %u, ipg = %u\n", start, bit, uspi->
s_ipg);
265 ufs_panic (sb,
"ufs_new_inode",
"internal error");
271 u32 initediblk = fs32_to_cpu(sb, ucg->
cg_u.
cg_u2.cg_initediblk);
273 if (bit + uspi->
s_inopb > initediblk &&
274 initediblk < fs32_to_cpu(sb, ucg->
cg_u.
cg_u2.cg_niblk))
275 ufs2_init_inodes_chunk(sb, ucpi, ucg);
278 fs32_sub(sb, &ucg->
cg_cs.cs_nifree, 1);
280 fs32_sub(sb, &sbi->fs_cs(cg).cs_nifree, 1);
283 fs32_add(sb, &ucg->
cg_cs.cs_ndir, 1);
285 fs32_add(sb, &sbi->fs_cs(cg).cs_ndir, 1);
298 ufsi->
i_flags = UFS_I(dir)->i_flags;
305 insert_inode_hash(inode);
306 mark_inode_dirty(inode);
309 struct buffer_head *bh;
319 "unable to read inode %lu\n",
322 goto fail_remove_inode;
325 ufs2_inode = (
struct ufs2_inode *)bh->b_data;
338 UFSD(
"allocating inode %lu\n", inode->
i_ino);
346 UFSD(
"EXIT (FAILED): err %d\n", err);
352 UFSD(
"EXIT (FAILED): err %d\n", err);