2012/10/23 Jaegeuk Kim <jaegeuk....@samsung.com>: >> > +void f2fs_truncate(struct inode *inode) >> > +{ >> > + if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || >> > + S_ISLNK(inode->i_mode))) >> > + return; >> > + >> > + if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) >> > + return; >> >> No truncate for an append only file? You call f2fs_truncate from >> evict_inode, so no block freeing when this kind of inode is deleted. > > Agreed. > >> >> > + >> > + if (!truncate_blocks(inode, i_size_read(inode))) { >> > + inode->i_mtime = inode->i_ctime = CURRENT_TIME; >> > + mark_inode_dirty(inode); >> > + } >> > + >> > + f2fs_balance_fs(F2FS_SB(inode->i_sb)); >> > +} >> > + >> > +static int f2fs_getattr(struct vfsmount *mnt, >> > + struct dentry *dentry, struct kstat *stat) >> > +{ >> > + struct inode *inode = dentry->d_inode; >> > + generic_fillattr(inode, stat); >> > + stat->blocks <<= 3; >> > + return 0; >> > +} >> > + >> > +#ifdef CONFIG_F2FS_FS_POSIX_ACL >> > +static void __setattr_copy(struct inode *inode, const struct iattr *attr) >> > +{ >> > + struct f2fs_inode_info *fi = F2FS_I(inode); >> > + unsigned int ia_valid = attr->ia_valid; >> > + >> > + if (ia_valid & ATTR_UID) >> > + inode->i_uid = attr->ia_uid; >> > + if (ia_valid & ATTR_GID) >> > + inode->i_gid = attr->ia_gid; >> > + if (ia_valid & ATTR_ATIME) >> > + inode->i_atime = timespec_trunc(attr->ia_atime, >> > + inode->i_sb->s_time_gran); >> > + if (ia_valid & ATTR_MTIME) >> > + inode->i_mtime = timespec_trunc(attr->ia_mtime, >> > + inode->i_sb->s_time_gran); >> > + if (ia_valid & ATTR_CTIME) >> > + inode->i_ctime = timespec_trunc(attr->ia_ctime, >> > + inode->i_sb->s_time_gran); >> > + if (ia_valid & ATTR_MODE) { >> > + umode_t mode = attr->ia_mode; >> > + >> > + if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) >> > + mode &= ~S_ISGID; >> > + set_acl_inode(fi, mode); >> > + } >> > +} >> > +#else >> > +#define __setattr_copy setattr_copy >> > +#endif >> > + >> > +int f2fs_setattr(struct dentry *dentry, struct iattr *attr) >> > +{ >> > + struct inode *inode = dentry->d_inode; >> > + struct f2fs_inode_info *fi = F2FS_I(inode); >> > + int err; >> > + >> > + err = inode_change_ok(inode, attr); >> > + if (err) >> > + return err; >> > + >> > + if ((attr->ia_valid & ATTR_SIZE) && >> > + attr->ia_size != i_size_read(inode)) { >> > + truncate_setsize(inode, attr->ia_size); >> > + f2fs_truncate(inode); >> >> No need to call truncate_pagecache & co.? > > truncate_setsize() calls truncate_pagecache(). > Any comment?
Yep, I didn't get my coffee yet :) Marco -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/