> From: Namjae Jeon <linkinjeon@xxxxxxxxxx> > Sent: Monday, November 27, 2023 8:12 AM > To: Mo, Yuezhang <Yuezhang.Mo@xxxxxxxx> > Cc: sj1557.seo@xxxxxxxxxxx; linux-fsdevel@xxxxxxxxxxxxxxx; Wu, Andy <Andy.Wu@xxxxxxxx>; Aoyama, Wataru (SGC) <Wataru.Aoyama@xxxxxxxx> > Subject: Re: [PATCH v4 1/2] exfat: change to get file size from DataLength > > [snip] > > + map_bh(bh_result, sb, phys); > > + if (buffer_delay(bh_result)) > > + clear_buffer_delay(bh_result); > > + > > if (create) { > > + sector_t valid_blks; > > + > > + valid_blks = EXFAT_B_TO_BLK_ROUND_UP(ei->valid_size, sb); > > + if (iblock < valid_blks && iblock + max_blocks >= valid_blks) { > > + max_blocks = valid_blks - iblock; > > + goto done; > > + } > I don't know why this check is needed. And Why do you call > exfat_map_new_buffer() about < valid blocks ? If part of a block has been written, the written part needs to be read out and the unwritten part needs to be zeroed before writing. So unwritten area and written area need to be mapped separately. There is no need to call exfat_map_new_buffer() if iblock + max_blocks < valid_blks. I will update the code. > > + > > err = exfat_map_new_buffer(ei, bh_result, pos); > > if (err) { > > exfat_fs_error(sb,