^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * linux/fs/sysv/ialloc.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * minix/bitmap.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 1991, 1992 Linus Torvalds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * ext/freelists.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Copyright (C) 1992 Remy Card (card@masi.ibp.fr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * xenix/alloc.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Copyright (C) 1992 Doug Evans
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * coh/alloc.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * Copyright (C) 1993 Pascal Haible, Bruno Haible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * sysv/ialloc.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * Copyright (C) 1993 Bruno Haible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * This file contains code for allocating/freeing inodes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/stddef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/stat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/buffer_head.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <linux/writeback.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include "sysv.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* We don't trust the value of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) sb->sv_sbd2->s_tinode = *sb->sv_sb_total_free_inodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) but we nevertheless keep it up to date. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* An inode on disk is considered free if both i_mode == 0 and i_nlink == 0. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* return &sb->sv_sb_fic_inodes[i] = &sbd->s_inode[i]; */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static inline sysv_ino_t *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) sv_sb_fic_inode(struct super_block * sb, unsigned int i)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct sysv_sb_info *sbi = SYSV_SB(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) if (sbi->s_bh1 == sbi->s_bh2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) return &sbi->s_sb_fic_inodes[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /* 512 byte Xenix FS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) unsigned int offset = offsetof(struct xenix_super_block, s_inode[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) if (offset < 512)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) return (sysv_ino_t*)(sbi->s_sbd1 + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) return (sysv_ino_t*)(sbi->s_sbd2 + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct sysv_inode *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) sysv_raw_inode(struct super_block *sb, unsigned ino, struct buffer_head **bh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct sysv_sb_info *sbi = SYSV_SB(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct sysv_inode *res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int block = sbi->s_firstinodezone + sbi->s_block_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) block += (ino-1) >> sbi->s_inodes_per_block_bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) *bh = sb_bread(sb, block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) if (!*bh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) res = (struct sysv_inode *)(*bh)->b_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) return res + ((ino-1) & sbi->s_inodes_per_block_1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) static int refill_free_cache(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct sysv_sb_info *sbi = SYSV_SB(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct buffer_head * bh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct sysv_inode * raw_inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) int i = 0, ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) ino = SYSV_ROOT_INO+1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) raw_inode = sysv_raw_inode(sb, ino, &bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) if (!raw_inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) while (ino <= sbi->s_ninodes) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) if (raw_inode->i_mode == 0 && raw_inode->i_nlink == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) *sv_sb_fic_inode(sb,i++) = cpu_to_fs16(SYSV_SB(sb), ino);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) if (i == sbi->s_fic_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) if ((ino++ & sbi->s_inodes_per_block_1) == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) brelse(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) raw_inode = sysv_raw_inode(sb, ino, &bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) if (!raw_inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) } else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) raw_inode++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) brelse(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) return i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) void sysv_free_inode(struct inode * inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) struct super_block *sb = inode->i_sb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct sysv_sb_info *sbi = SYSV_SB(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) unsigned int ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) struct buffer_head * bh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) struct sysv_inode * raw_inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) unsigned count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) sb = inode->i_sb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) ino = inode->i_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) if (ino <= SYSV_ROOT_INO || ino > sbi->s_ninodes) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) printk("sysv_free_inode: inode 0,1,2 or nonexistent inode\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) raw_inode = sysv_raw_inode(sb, ino, &bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) if (!raw_inode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) printk("sysv_free_inode: unable to read inode block on device "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) "%s\n", inode->i_sb->s_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) mutex_lock(&sbi->s_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) if (count < sbi->s_fic_size) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) *sv_sb_fic_inode(sb,count++) = cpu_to_fs16(sbi, ino);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) *sbi->s_sb_fic_count = cpu_to_fs16(sbi, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) fs16_add(sbi, sbi->s_sb_total_free_inodes, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) dirty_sb(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) memset(raw_inode, 0, sizeof(struct sysv_inode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) mark_buffer_dirty(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) mutex_unlock(&sbi->s_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) brelse(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) struct inode * sysv_new_inode(const struct inode * dir, umode_t mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) struct super_block *sb = dir->i_sb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) struct sysv_sb_info *sbi = SYSV_SB(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) struct inode *inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) sysv_ino_t ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) unsigned count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct writeback_control wbc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) .sync_mode = WB_SYNC_NONE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) inode = new_inode(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) if (!inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) return ERR_PTR(-ENOMEM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) mutex_lock(&sbi->s_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) if (count == 0 || (*sv_sb_fic_inode(sb,count-1) == 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) count = refill_free_cache(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) if (count == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) iput(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) mutex_unlock(&sbi->s_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) return ERR_PTR(-ENOSPC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /* Now count > 0. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ino = *sv_sb_fic_inode(sb,--count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) *sbi->s_sb_fic_count = cpu_to_fs16(sbi, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) fs16_add(sbi, sbi->s_sb_total_free_inodes, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) dirty_sb(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) inode_init_owner(inode, dir, mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) inode->i_ino = fs16_to_cpu(sbi, ino);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) inode->i_blocks = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) memset(SYSV_I(inode)->i_data, 0, sizeof(SYSV_I(inode)->i_data));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) SYSV_I(inode)->i_dir_start_lookup = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) insert_inode_hash(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) mark_inode_dirty(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) sysv_write_inode(inode, &wbc); /* ensure inode not allocated again */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) mark_inode_dirty(inode); /* cleared by sysv_write_inode() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /* That's it. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) mutex_unlock(&sbi->s_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) return inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) unsigned long sysv_count_free_inodes(struct super_block * sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) struct sysv_sb_info *sbi = SYSV_SB(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct buffer_head * bh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct sysv_inode * raw_inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) int ino, count, sb_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) mutex_lock(&sbi->s_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) sb_count = fs16_to_cpu(sbi, *sbi->s_sb_total_free_inodes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) if (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) goto trust_sb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /* this causes a lot of disk traffic ... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) ino = SYSV_ROOT_INO+1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) raw_inode = sysv_raw_inode(sb, ino, &bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) if (!raw_inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) goto Eio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) while (ino <= sbi->s_ninodes) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) if (raw_inode->i_mode == 0 && raw_inode->i_nlink == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if ((ino++ & sbi->s_inodes_per_block_1) == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) brelse(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) raw_inode = sysv_raw_inode(sb, ino, &bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) if (!raw_inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) goto Eio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) } else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) raw_inode++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) brelse(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) if (count != sb_count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) goto Einval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) mutex_unlock(&sbi->s_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) Einval:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) printk("sysv_count_free_inodes: "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) "free inode count was %d, correcting to %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) sb_count, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) if (!sb_rdonly(sb)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) *sbi->s_sb_total_free_inodes = cpu_to_fs16(SYSV_SB(sb), count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) dirty_sb(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) Eio:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) printk("sysv_count_free_inodes: unable to read inode table\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) trust_sb:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) count = sb_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) }