mbox series

[v5,0/2] exfat: get file size from DataLength

Message ID PUZPR04MB63164691A5119414706F66998182A@PUZPR04MB6316.apcprd04.prod.outlook.com (mailing list archive)
Headers show
Series exfat: get file size from DataLength | expand

Message

Yuezhang.Mo@sony.com Nov. 30, 2023, 3:09 a.m. UTC
From the exFAT specification, the file size should get from 'DataLength'
of Stream Extension Directory Entry, not 'ValidDataLength'.

Without this patch set, 'DataLength' is always same with 'ValidDataLength'
and get file size from 'ValidDataLength'. If the file is created by other
exFAT implementation and 'DataLength' is different from 'ValidDataLength',
this exFAT implementation will not be compatible.

Changes for v5:
  - do not call exfat_map_new_buffer() if iblock + max_blocks < valid_blks.
  - Reorganized the logic of exfat_get_block(), both writing and reading use
    block index judgment.
  - Remove unnecessary code moves.
  - Reduce sync in exfat_file_write_iter()

Changes for v4:
  - Rebase for linux-6.7-rc1
  - Use block_write_begin() instead of cont_write_begin() in exfat_write_begin()
  - In exfat_cont_expand(), use ei->i_size_ondisk instead of i_size_read() to
    get the number of clusters of the file.

Changes for v3:
  - Rebase to linux-6.6
  - Move update ->valid_size from exfat_file_write_iter() to exfat_write_end()
  - Use block_write_begin() instead of exfat_write_begin() in exfat_file_zeroed_range()
  - Remove exfat_expand_and_zero()

Changes for v2:
  - Fix race when checking i_size on direct i/o read

Yuezhang Mo (2):
  exfat: change to get file size from DataLength
  exfat: do not zero the extended part

 fs/exfat/exfat_fs.h |   2 +
 fs/exfat/file.c     | 197 +++++++++++++++++++++++++++++++++++++++-----
 fs/exfat/inode.c    | 136 ++++++++++++++++++++++++++----
 fs/exfat/namei.c    |   6 ++
 4 files changed, 303 insertions(+), 38 deletions(-)