void sysv_truncate(struct inode * inode) { /* If this is called from sysv_put_inode, we needn't worry about * races as we are just losing the last reference to the inode. * If this is called from another place, let's hope it's a regular * file. * Truncating symbolic links is strange. We assume we don't truncate * a directory we are just modifying. We ensure we don't truncate * a regular file we are just writing to, by use of a lock. */ if (S_ISLNK(inode->i_mode)) printk("sysv_truncate: truncating symbolic link\n"); else if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) return; if (inode->i_sb->sv_block_size_ratio_bits > 0) { /* block_size < BLOCK_SIZE ? */ coh_lock_inode(inode); /* do not write to the inode while we truncate */ while (coh_trunc_all(inode)) { current->counter = 0; schedule(); } inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_dirt = 1; coh_unlock_inode(inode); } else { while (trunc_all(inode)) { current->counter = 0; schedule(); } inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_dirt = 1; } }
void sysv_truncate(struct inode * inode) { /* If this is called from sysv_put_inode, we needn't worry about * races as we are just losing the last reference to the inode. * If this is called from another place, let's hope it's a regular * file. * Truncating symbolic links is strange. We assume we don't truncate * a directory we are just modifying. We ensure we don't truncate * a regular file we are just writing to, by use of a lock. */ if (S_ISLNK(inode->i_mode)) printk("sysv_truncate: truncating symbolic link\n"); else if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) return; while (trunc_all(inode)) { current->counter = 0; schedule(); } inode->i_mtime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); }