Messages in this thread | | | From | OGAWA Hirofumi <> | Subject | Re: [PATCH v3 2/6] fat: add fat_fallocate operation | Date | Mon, 03 Feb 2014 13:14:16 +0900 |
| |
Sorry for long delay.
Namjae Jeon <linkinjeon@gmail.com> writes:
> + if (mode & FALLOC_FL_KEEP_SIZE) { > + /* First compute the number of clusters to be allocated */ > + mm_bytes = offset + len - round_up(MSDOS_I(inode)->mmu_private, > + sbi->cluster_size);
This should use ->i_disksize?
[...]
> + /* Release unwritten fallocated blocks on inode eviction. */ > + if (MSDOS_I(inode)->mmu_private < MSDOS_I(inode)->i_disksize) { > + 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 > + * synchrnously to avoid any corruption on the next > + * access to the cluster chain for the file. > + */ > + err = fat_sync_inode(inode);
Ah, good catch. We have to update i_size. I was forgetting about this. Well, sync inode unconditionally would not be good. Maybe, we better to use __fat_write_inode() with inode_needs_sync() or such. -- OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
| |