void affs_put_super(struct super_block *sb) { int i; pr_debug("affs_put_super()\n"); lock_super(sb); for (i = 0; i < sb->u.affs_sb.s_bm_count; i++) affs_brelse(sb->u.affs_sb.s_bitmap[i].bm_bh); if (!(sb->s_flags & MS_RDONLY)) { ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->bm_flag = htonl(1); secs_to_datestamp(CURRENT_TIME, &ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->disk_altered); affs_fix_checksum(sb->s_blocksize,sb->u.affs_sb.s_root_bh->b_data,5); mark_buffer_dirty(sb->u.affs_sb.s_root_bh,1); } if (sb->u.affs_sb.s_flags & SF_PREFIX) kfree(sb->u.affs_sb.s_prefix); kfree(sb->u.affs_sb.s_bitmap); affs_brelse(sb->u.affs_sb.s_root_bh); /* I'm not happy with this. It would be better to save the previous * value of this devices blksize_size[][] in the super block and * restore it here, but with the affs superblock being quite large * already ... */ set_blocksize(sb->s_dev,BLOCK_SIZE); sb->s_dev = 0; unlock_super(sb); MOD_DEC_USE_COUNT; return; }
static void affs_write_super(struct super_block *sb) { int i, clean = 2; if (!(sb->s_flags & MS_RDONLY)) { lock_super(sb); for (i = 0, clean = 1; i < sb->u.affs_sb.s_bm_count; i++) { if (sb->u.affs_sb.s_bitmap[i].bm_bh) { if (buffer_dirty(sb->u.affs_sb.s_bitmap[i].bm_bh)) { clean = 0; break; } } } unlock_super(sb); ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->bm_flag = htonl(clean); secs_to_datestamp(CURRENT_TIME, &ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->disk_altered); affs_fix_checksum(sb->s_blocksize,sb->u.affs_sb.s_root_bh->b_data,5); mark_buffer_dirty(sb->u.affs_sb.s_root_bh,1); sb->s_dirt = !clean; /* redo until bitmap synced */ } else sb->s_dirt = 0; pr_debug("AFFS: write_super() at %d, clean=%d\n",CURRENT_TIME,clean); }
static void affs_put_super(struct super_block *sb) { int i; pr_debug("AFFS: put_super()\n"); for (i = 0; i < sb->u.affs_sb.s_bm_count; i++) affs_brelse(sb->u.affs_sb.s_bitmap[i].bm_bh); if (!(sb->s_flags & MS_RDONLY)) { ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->bm_flag = be32_to_cpu(1); secs_to_datestamp(CURRENT_TIME, &ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->disk_altered); affs_fix_checksum(sb->s_blocksize,sb->u.affs_sb.s_root_bh->b_data,5); mark_buffer_dirty(sb->u.affs_sb.s_root_bh,1); } if (sb->u.affs_sb.s_prefix) kfree(sb->u.affs_sb.s_prefix); kfree(sb->u.affs_sb.s_bitmap); affs_brelse(sb->u.affs_sb.s_root_bh); /* * Restore the previous value of this device's blksize_size[][] */ set_blocksize(sb->s_dev, sb->u.affs_sb.s_blksize); MOD_DEC_USE_COUNT; return; }
void affs_put_super(struct super_block *sb) { int i; pr_debug("affs_put_super()\n"); lock_super(sb); for (i = 0; i < sb->u.affs_sb.s_bm_count; i++) affs_brelse(sb->u.affs_sb.s_bitmap[i].bm_bh); ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->bm_flag = htonl(1); secs_to_datestamp(CURRENT_TIME,&ROOT_END_S(sb->u.affs_sb.s_root_bh->b_data,sb)->disk_altered); affs_fix_checksum(sb->s_blocksize,sb->u.affs_sb.s_root_bh->b_data,5); mark_buffer_dirty(sb->u.affs_sb.s_root_bh,1); if (sb->u.affs_sb.s_flags & SF_PREFIX) kfree(sb->u.affs_sb.s_prefix); kfree(sb->u.affs_sb.s_bitmap); affs_brelse(sb->u.affs_sb.s_root_bh); set_blocksize(sb->s_dev,BLOCK_SIZE); sb->s_dev = 0; unlock_super(sb); MOD_DEC_USE_COUNT; return; }
int affs_write_inode(struct inode *inode, struct writeback_control *wbc) { struct super_block *sb = inode->i_sb; struct buffer_head *bh; struct affs_tail *tail; uid_t uid; gid_t gid; pr_debug("AFFS: write_inode(%lu)\n",inode->i_ino); if (!inode->i_nlink) // possibly free block return 0; bh = affs_bread(sb, inode->i_ino); if (!bh) { affs_error(sb,"write_inode","Cannot read block %lu",inode->i_ino); return -EIO; } tail = AFFS_TAIL(sb, bh); if (tail->stype == cpu_to_be32(ST_ROOT)) { secs_to_datestamp(inode->i_mtime.tv_sec,&AFFS_ROOT_TAIL(sb, bh)->root_change); } else { tail->protect = cpu_to_be32(AFFS_I(inode)->i_protect); tail->size = cpu_to_be32(inode->i_size); secs_to_datestamp(inode->i_mtime.tv_sec,&tail->change); if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) { uid = inode->i_uid; gid = inode->i_gid; if (AFFS_SB(sb)->s_flags & SF_MUFS) { if (inode->i_uid == 0 || inode->i_uid == 0xFFFF) uid = inode->i_uid ^ ~0; if (inode->i_gid == 0 || inode->i_gid == 0xFFFF) gid = inode->i_gid ^ ~0; } if (!(AFFS_SB(sb)->s_flags & SF_SETUID)) tail->uid = cpu_to_be16(uid); if (!(AFFS_SB(sb)->s_flags & SF_SETGID)) tail->gid = cpu_to_be16(gid); } } affs_fix_checksum(sb, bh); mark_buffer_dirty_inode(bh, inode); affs_brelse(bh); affs_free_prealloc(inode); return 0; }
void affs_write_inode(struct inode *inode) { struct buffer_head *bh; struct file_end *file_end; uid_t uid; gid_t gid; pr_debug("AFFS: write_inode(%lu)\n",inode->i_ino); if (!inode->i_nlink) return; if (!(bh = bread(inode->i_dev,inode->i_ino,AFFS_I2BSIZE(inode)))) { affs_error(inode->i_sb,"write_inode","Cannot read block %lu",inode->i_ino); return; } file_end = GET_END_PTR(struct file_end, bh->b_data,AFFS_I2BSIZE(inode)); if (file_end->secondary_type == be32_to_cpu(ST_ROOT)) { secs_to_datestamp(inode->i_mtime,&ROOT_END(bh->b_data,inode)->disk_altered); } else { file_end->protect = cpu_to_be32(inode->u.affs_i.i_protect ^ FIBF_OWNER); file_end->byte_size = cpu_to_be32(inode->i_size); secs_to_datestamp(inode->i_mtime,&file_end->created); if (!(inode->i_ino == inode->i_sb->u.affs_sb.s_root_block)) { uid = inode->i_uid; gid = inode->i_gid; if (inode->i_sb->u.affs_sb.s_flags & SF_MUFS) { if (inode->i_uid == 0 || inode->i_uid == 0xFFFF) uid = inode->i_uid ^ ~0; if (inode->i_gid == 0 || inode->i_gid == 0xFFFF) gid = inode->i_gid ^ ~0; } if (!(inode->i_sb->u.affs_sb.s_flags & SF_SETUID)) file_end->owner_uid = cpu_to_be16(uid); if (!(inode->i_sb->u.affs_sb.s_flags & SF_SETGID)) file_end->owner_gid = cpu_to_be16(gid); } } affs_fix_checksum(AFFS_I2BSIZE(inode),bh->b_data,5); mark_buffer_dirty(bh,1); brelse(bh); }
static void affs_commit_super(struct super_block *sb, int clean) { struct affs_sb_info *sbi = AFFS_SB(sb); struct buffer_head *bh = sbi->s_root_bh; struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh); tail->bm_flag = cpu_to_be32(clean); secs_to_datestamp(get_seconds(), &tail->disk_change); affs_fix_checksum(sb, bh); mark_buffer_dirty(bh); }
static void affs_commit_super(struct super_block *sb, int wait) { struct affs_sb_info *sbi = AFFS_SB(sb); struct buffer_head *bh = sbi->s_root_bh; struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh); lock_buffer(bh); secs_to_datestamp(get_seconds(), &tail->disk_change); affs_fix_checksum(sb, bh); unlock_buffer(bh); mark_buffer_dirty(bh); if (wait) sync_dirty_buffer(bh); }
static void affs_write_super(struct super_block *sb) { int clean = 2; if (!(sb->s_flags & MS_RDONLY)) { // if (AFFS_SB->s_bitmap[i].bm_bh) { // if (buffer_dirty(AFFS_SB->s_bitmap[i].bm_bh)) { // clean = 0; AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->bm_flag = be32_to_cpu(clean); secs_to_datestamp(CURRENT_TIME, &AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->disk_change); affs_fix_checksum(sb, AFFS_SB->s_root_bh); mark_buffer_dirty(AFFS_SB->s_root_bh); sb->s_dirt = !clean; /* redo until bitmap synced */ } else sb->s_dirt = 0; pr_debug("AFFS: write_super() at %lu, clean=%d\n", CURRENT_TIME, clean); }
static void affs_put_super(struct super_block *sb) { pr_debug("AFFS: put_super()\n"); if (!(sb->s_flags & MS_RDONLY)) { AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->bm_flag = be32_to_cpu(1); secs_to_datestamp(CURRENT_TIME, &AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->disk_change); affs_fix_checksum(sb, AFFS_SB->s_root_bh); mark_buffer_dirty(AFFS_SB->s_root_bh); } affs_brelse(AFFS_SB->s_bmap_bh); if (AFFS_SB->s_prefix) kfree(AFFS_SB->s_prefix); kfree(AFFS_SB->s_bitmap); affs_brelse(AFFS_SB->s_root_bh); return; }
static void affs_write_super(struct super_block *sb) { int clean = 2; struct affs_sb_info *sbi = AFFS_SB(sb); if (!(sb->s_flags & MS_RDONLY)) { // if (sbi->s_bitmap[i].bm_bh) { // if (buffer_dirty(sbi->s_bitmap[i].bm_bh)) { // clean = 0; AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(clean); secs_to_datestamp(get_seconds(), &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change); affs_fix_checksum(sb, sbi->s_root_bh); mark_buffer_dirty(sbi->s_root_bh); sb->s_dirt = !clean; /* redo until bitmap synced */ } else sb->s_dirt = 0; pr_debug("AFFS: write_super() at %lu, clean=%d\n", get_seconds(), clean); }
static void affs_put_super(struct super_block *sb) { struct affs_sb_info *sbi = AFFS_SB(sb); pr_debug("AFFS: put_super()\n"); if (!(sb->s_flags & MS_RDONLY)) { AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(1); secs_to_datestamp(get_seconds(), &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change); affs_fix_checksum(sb, sbi->s_root_bh); mark_buffer_dirty(sbi->s_root_bh); } kfree(sbi->s_prefix); affs_free_bitmap(sb); affs_brelse(sbi->s_root_bh); kfree(sbi); sb->s_fs_info = NULL; return; }