> > Namjae Jeon <namjae.jeon@xxxxxxxxxxx> writes: > > > +static int __fat_write_inode(struct inode *inode, int wait); > > static void fat_evict_inode(struct inode *inode) > > { > > truncate_inode_pages_final(&inode->i_data); > > if (!inode->i_nlink) { > > inode->i_size = 0; > > fat_truncate_blocks(inode, 0); > > + } else { > > + /* Release unwritten fallocated blocks on inode eviction. */ > > + if ((inode->i_blocks << 9) > > > + round_up(MSDOS_I(inode)->mmu_private, > > + inode->i_sb->s_blocksize)) { > > Don't we need to check alignment of cluster size here, not blocksize? > Otherwise, looks like we call write_inode() without actual truncate. > > (BTW, IMHO, Adding own static function for this, would be easier to > read.) Yes, We need to align with cluster size. I will fix it. Thanks for review! > > > + int err; > > + > > + fat_truncate_blocks(inode, MSDOS_I(inode)->mmu_private); > > + /* Fallocate results in updating the i_start/iogstart > > + * for the zero byte file. So, make it return to > > + * original state during evict and commit it to avoid > > + * any corruption on the next access to the cluster > > + * chain for the file. > > + */ > > + err = __fat_write_inode(inode, inode_needs_sync(inode)); > > + if (err) { > > + fat_msg(inode->i_sb, KERN_WARNING, "Failed to " > > + "update on disk inode for unused fallocated " > > + "blocks, inode could be corrupted. Please run " > > + "fsck"); > > + } > > + } > -- > OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html