[PATCH] fat: Mark dirty just before updating metadata

2021-03-14 Thread Tetsuhiro Kohada
suppress errors when updating dirty. Signed-off-by: Tetsuhiro Kohada --- fs/fat/dir.c | 2 + fs/fat/fat.h | 4 ++ fs/fat/fatent.c | 8 +++- fs/fat/file.c| 1 + fs/fat/inode.c | 100 +++ fs/fat/misc.c| 1 + fs

[PATCH 1/2] exfat: commonize getting information from dir-entries

2020-10-21 Thread Tetsuhiro Kohada
Move 'getting dir-entries information' from exfat_find() to exfat_find_dir_entry(), and make it common in exfat_readdir(). And, remove unused parameter in exfat_find_dir_entry(). Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 75 +

[PATCH 2/2] exfat: simplify exfat_hint_femp structure

2020-10-21 Thread Tetsuhiro Kohada
The hint provided by exfat_hint_femp is that the cluster number is enough, so replace exfat_chain with the cluster number. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 3 +-- fs/exfat/exfat_fs.h | 2 +- fs/exfat/namei.c| 19 ++- 3 files changed, 8 insertions

[PATCH v4 1/2] exfat: add exfat_update_inode()

2020-10-18 Thread Tetsuhiro Kohada
Integrate exfat_sync_inode() and mark_inode_dirty() as exfat_update_inode() Also, return the result of _exfat_write_inode () when sync is specified. Signed-off-by: Tetsuhiro Kohada --- Changes in v4 - no change Changes in v3 - no change Changes in v2 - no change fs/exfat/exfat_fs.h | 2

[PATCH v4 2/2] exfat: aggregate dir-entry updates into __exfat_write_inode().

2020-10-18 Thread Tetsuhiro Kohada
In __exfat_write_inode(), rename 'on_disk_size' to 'filesize' and add adjustment when filesize is 0. Reported-by: kernel test robot Signed-off-by: Tetsuhiro Kohada --- Changes in v4 - Remove debug message Changes in v3 - Remove update_inode() in exfat_map_cluster()/exfat_truncate()

Re: [PATCH v3 2/2] exfat: aggregate dir-entry updates into __exfat_write_inode().

2020-10-18 Thread Tetsuhiro Kohada
ze_read(inode), + (clu_offset << sbi->sect_per_clus_bits) * 512, + last_clu); Is this leftover print from debugging? Oops! Yes, just as you said. I will post V4 soon. Is there any other problem? BR --- Tetsuhiro Kohada

Re: [PATCH v3 1/2] exfat: add exfat_update_inode()

2020-10-07 Thread Tetsuhiro Kohada
"aggregate dir-entry updates into __exfat_write_inode()" BR --- Tetsuhiro Kohada

[PATCH v3 1/2] exfat: add exfat_update_inode()

2020-10-01 Thread Tetsuhiro Kohada
Integrate exfat_sync_inode() and mark_inode_dirty() as exfat_update_inode() Also, return the result of _exfat_write_inode () when sync is specified. Signed-off-by: Tetsuhiro Kohada --- Changes in v3 - no change Changes in v2 - no change fs/exfat/exfat_fs.h | 2 +- fs/exfat/file.c | 5

[PATCH v3 2/2] exfat: aggregate dir-entry updates into __exfat_write_inode().

2020-10-01 Thread Tetsuhiro Kohada
In __exfat_write_inode(), rename 'on_disk_size' to 'filesize' and add adjustment when filesize is 0. Signed-off-by: Tetsuhiro Kohada --- Changes in v3 - Remove update_inode() in exfat_map_cluster()/exfat_truncate() - Update commit-message Changes in v2 - Fix endian issue

Re: [PATCH 2/3] exfat: remove useless check in exfat_move_file()

2020-09-30 Thread Tetsuhiro Kohada
ther? I think I explained the reason for each implementation. If it's not enough, I'd like to explain it in more detail. BR --- Tetsuhiro Kohada

Re: [PATCH 2/3] exfat: remove useless check in exfat_move_file()

2020-09-30 Thread Tetsuhiro Kohada
. I am waiting for your reply about "integrates dir-entry getting and validation" patch. As I know, your patch is being under review by Namjae. OK. I'll discuss it with him. If possible, please let me know your opinion. BR --- Tetsuhiro Kohada

Re: [PATCH 2/3] exfat: remove useless check in exfat_move_file()

2020-09-29 Thread Tetsuhiro Kohada
lean up. I understand that a small patch is desirable, but the latter has "two similar functions". Which is better for you to review the patch? BR --- Tetsuhiro Kohada

[PATCH v2 1/2] exfat: add exfat_update_inode()

2020-09-19 Thread Tetsuhiro Kohada
Integrate exfat_sync_inode() and mark_inode_dirty() as exfat_update_inode() Also, return the result of _exfat_write_inode () when sync is specified. Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - no change fs/exfat/exfat_fs.h | 2 +- fs/exfat/file.c | 5 + fs/exfat/inode.c

[PATCH v2 2/2] exfat: aggregate dir-entry updates into __exfat_write_inode().

2020-09-19 Thread Tetsuhiro Kohada
lesize' and add adjustment when filesize is 0. Reported-by: kernel test robot Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Fix endian issue fs/exfat/file.c | 49 +--- fs/exfat/inode.c | 42 +++-- f

[PATCH 2/2] exfat: aggregate dir-entry updates into __exfat_write_inode().

2020-09-17 Thread Tetsuhiro Kohada
lesize' and add adjustment when filesize is 0. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/file.c | 49 +--- fs/exfat/inode.c | 42 +++-- fs/exfat/namei.c | 26 + 3 files changed, 21 inserti

[PATCH 1/2] exfat: add exfat_update_inode()

2020-09-17 Thread Tetsuhiro Kohada
Integrate exfat_sync_inode() and mark_inode_dirty() as exfat_update_inode() Also, return the result of _exfat_write_inode () when sync is specified. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/exfat_fs.h | 2 +- fs/exfat/file.c | 5 + fs/exfat/inode.c| 9 +++-- fs/exfat

[PATCH v2] exfat: remove 'rwoffset' in exfat_inode_info

2020-09-16 Thread Tetsuhiro Kohada
y via dir_entry->entry. Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - 'cpos' point to the next of entry-set - return the index of dir-entry via dir_entry->entry - fix commit-message fs/exfat/dir.c | 21 + fs/exfat/exfat_fs.h | 2 -- fs/exfat/file.

Re: [PATCH 2/3] exfat: remove useless check in exfat_move_file()

2020-09-16 Thread Tetsuhiro Kohada
Or do you mean the codes on vfs? You can find in do_renameat2(). --- around 'fs/namei.c:4440' If the destination ancestors are itself, our driver will not be called. BTW Are you busy now? I am waiting for your reply about "integrates dir-entry getting and validation" patch. BR --- Tetsuhiro Kohada

Re: [PATCH] exfat: remove 'rwoffset' in exfat_inode_info

2020-09-15 Thread Tetsuhiro Kohada
On 2020/09/12 14:01, Sungjong Seo wrote: Remove 'rwoffset' in exfat_inode_info and replace it with the parameter(cpos) of exfat_readdir. Since rwoffset of is referenced only by exfat_readdir, it is not necessary a exfat_inode_info's member. Signed-off-by: Tetsuhiro Kohada

[PATCH 2/3] exfat: remove useless check in exfat_move_file()

2020-09-10 Thread Tetsuhiro Kohada
In exfat_move_file(), the identity of source and target directory has been checked by the caller. Also, it gets stream.start_clu from file dir-entry, which is an invalid determination. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/namei.c | 5 - 1 file changed, 5 deletions(-) diff --git a

[PATCH 3/3] exfat: replace memcpy with structure assignment

2020-09-10 Thread Tetsuhiro Kohada
Use structure assignment instead of memcpy. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 7 ++- fs/exfat/inode.c | 2 +- fs/exfat/namei.c | 15 +++ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index fa5bb72aa295

[PATCH 1/3] exfat: remove useless directory scan in exfat_add_entry()

2020-09-10 Thread Tetsuhiro Kohada
There is nothing in directory just created, so there is no need to scan. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/namei.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index b966b9120c9c..803748946ddb 100644 --- a/fs

[PATCH] exfat: remove 'rwoffset' in exfat_inode_info

2020-09-09 Thread Tetsuhiro Kohada
Remove 'rwoffset' in exfat_inode_info and replace it with the parameter(cpos) of exfat_readdir. Since rwoffset of is referenced only by exfat_readdir, it is not necessary a exfat_inode_info's member. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 16 ++-

[PATCH] exfat: eliminate dead code in exfat_find()

2020-09-02 Thread Tetsuhiro Kohada
The exfat_find_dir_entry() called by exfat_find() doesn't return -EEXIST. Therefore, the root-dir information setting is never executed. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 1 - fs/exfat/namei.c | 120 +++ 2 files change

Re: [PATCH v4 1/5] exfat: integrates dir-entry getting and validation

2020-08-27 Thread Tetsuhiro Kohada
goto free_es; Why do you unnecessarily check entries with two loops? Please refer to the patch I sent. This order is possible. However, TYPE_SECONDARY loop will be back as checksum loop. In the next patch, I can fix the 'TYPE_SECONDARY loop' order. do you need it? BR --- Tetsuhiro Kohada

Re: [PATCH v3] exfat: integrates dir-entry getting and validation

2020-08-27 Thread Tetsuhiro Kohada
7; by checksum is much higher) So as I suggested earlier, You can make it with an argument flags so that we skip the validation. No need skip the validation, I think. The run-time costs for validation are pretty low. The reason I want to remove the validation is because I want to keep the code simple. (KISS principle) BR --- Tetsuhiro Kohada

[PATCH v4 4/5] exfat: add dir-entry set checksum validation

2020-08-26 Thread Tetsuhiro Kohada
Add checksum validation for dir-entry set when getting it. exfat_calc_entry_set_chksum_with() also validates entry-type. Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Add error log if checksum mismatch Changes in v3: - Nothing Changes in v4: - Into patch series '[PATCH v4]

[PATCH v4 5/5] exfat: write only modified part of dir-entry set

2020-08-26 Thread Tetsuhiro Kohada
Currently exfat_free_dentry_set() writes all of dir-entry set. Change it to write only the modified part of dir-entry set. And, Integrate exfat_free_dentry_set() and exfat_update_dir_chksum_with_entry_set() as exfat_put_dentry_set(). Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Based on

[PATCH v4 3/5] exfat: unify name extraction

2020-08-26 Thread Tetsuhiro Kohada
using exfat_entry_set_cache and exfat_get_uniname_from_name_entries(), like exfat_readdir(). And, remove unused functions/parameters. Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Add error check when extracting name - Remove temporary exfat_get_dentry_set() with ES_2_ENTRIES - Remove dupl

[PATCH v4 2/5] exfat: add NameLength check when extracting name

2020-08-26 Thread Tetsuhiro Kohada
hange to get the information of file/stream-ext dir-entries via the member variable of exfat_entry_set_cache. Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Add error check when extracting name - Change error from EIO to EINVAL when the name length is invalid - Correct the spelling in c

[PATCH v4 1/5] exfat: integrates dir-entry getting and validation

2020-08-26 Thread Tetsuhiro Kohada
ries. Pre-Validated 'file' and 'stream-ext' dir-entries are provided via ES_FILE/ES_STREAM macros. And, rename TYPE_EXTEND to TYPE_NAME. Suggested-by: Sungjong Seo Suggested-by: Namjae Jeon Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Change verification order - Verifi

Re: [PATCH v3] exfat: integrates dir-entry getting and validation

2020-08-25 Thread Tetsuhiro Kohada
ion in this function? What kind of problem are you worried about if this function does not validate TYPE_NAME? (for preserve the current behavior?) Don't worry, I will add TYPE_NAME verification to the v4 patch. I will post it later today. BR --- Tetsuhiro Kohada

Re: [PATCH v3] exfat: integrates dir-entry getting and validation

2020-08-25 Thread Tetsuhiro Kohada
I'll add TYPE_NAME verification after checksum verification, in next patch. However, I think it is enough to validate TYPE_NAME when extracting name. Could you please tell me why you think you need TYPE_NAME validation here? BR --- Tetsuhiro Kohada

[PATCH] exfat: fix pointer error checking

2020-08-25 Thread Tetsuhiro Kohada
Fix missing result check of exfat_build_inode(). And use PTR_ERR_OR_ZERO instead of PTR_ERR. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/namei.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 2aff6605fecc

Re: [PATCH 2/2] exfat: unify name extraction

2020-08-25 Thread Tetsuhiro Kohada
the offset and cluster number aren't linked. BTW, this patch is not related to the hint code. I think it would be better to keep the original code in this patch and improve it with a separate patch. I think so, too. I'll try another patch. BR --- Tetsuhiro Kohada

Re: [PATCH v3] exfat: integrates dir-entry getting and validation

2020-08-25 Thread Tetsuhiro Kohada
entry.file.modify_date, - ep->dentry.file.modify_time_cs); + ES_FILE(es).modify_tz, + ES_FILE(es).modify_time, + ES_FILE(es).modify_date, + ES_FILE(es).modify_time_cs); exfat_get_entry_time(sbi, &info->atime, - ep->dentry.file.access_tz, - ep->dentry.file.access_time, - ep->dentry.file.access_date, + ES_FILE(es).access_tz, + ES_FILE(es).access_time, + ES_FILE(es).access_date, 0); exfat_free_dentry_set(es, false); BR --- Tetsuhiro Kohada

[PATCH v2 2/2] exfat: write only modified part of dir-entry set

2020-08-20 Thread Tetsuhiro Kohada
s dir-entry getting and validation' '[PATCH v2] exfat: add NameLength check when extracting name' '[PATCH v2] exfat: unify name extraction' Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Based on v2 'name-length' patches fs/exfat/dir.c | 31 +

[PATCH v2 1/2] exfat: add dir-entry set checksum validation

2020-08-20 Thread Tetsuhiro Kohada
Add checksum validation for dir-entry set when getting it. exfat_calc_entry_set_chksum_with() also validates entry-type. ** This patch depends on: '[PATCH v3] exfat: integrates dir-entry getting and validation' Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Add error log i

[PATCH v2 1/2] exfat: add NameLength check when extracting name

2020-08-18 Thread Tetsuhiro Kohada
hange to get the information of file/stream-ext dir-entries via the member variable in exfat_entry_set_cache. ** This patch depends on: '[PATCH v3] exfat: integrates dir-entry getting and validation'. Suggested-by: Sungjong Seo Signed-off-by: Tetsuhiro Kohada --- Changes in v2 -

[PATCH v2 2/2] exfat: unify name extraction

2020-08-18 Thread Tetsuhiro Kohada
eters. ** This patch depends on: '[PATCH v3] exfat: integrates dir-entry getting and validation'. Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Add error check when extracting name - Remove temporary exfat_get_dentry_set() with ES_2_ENTRIES - Remove duplicate parts in commit mes

Re: [PATCH v3] exfat: remove EXFAT_SB_DIRTY flag

2020-08-17 Thread Tetsuhiro Kohada
Thank you for your reply. Most of the NAND flash devices and HDDs have wear leveling and bad sector replacement algorithms applied. So I think that the life of the boot sector will not be exhausted first. I'm not too worried about the life of the boot-sector. I'm worried about write failure

Re: [PATCH 1/2] exfat: add dir-entry set checksum validation

2020-08-12 Thread Tetsuhiro Kohada
chksum != le16_to_cpu(es->de_file->checksum Please add error print log if checksum mismatch error happen. OK. I'll add in v2. BR --- Tetsuhiro Kohada

Re: [PATCH 1/2] exfat: add NameLength check when extracting name

2020-08-12 Thread Tetsuhiro Kohada
gh to validate the name when it is needed. This is a file-system driver, not fsck. Validation is possible in exfat_get_dentry_set(), but unnecessary. Why do you want to validate the name in exfat_get_dentry_set()? BR --- Tetsuhiro Kohada

Re: [PATCH v3] exfat: integrates dir-entry getting and validation

2020-08-12 Thread Tetsuhiro Kohada
eam could be strongly typed. I don't think we need excessive flexibility. BR --- Tetsuhiro Kohada

Re: [PATCH v3] exfat: remove EXFAT_SB_DIRTY flag

2020-08-12 Thread Tetsuhiro Kohada
When should VOL_DIRTY be cleared? The current behavior is ... Case of mkdir, rmdir, rename: - set VOL_DIRTY before operation - set VOL_CLEAN after operating. In async mode, it is actually written to the media after 30 seconds. Case of cp, touch: - set VOL_DIRTY before operation

Re: [PATCH 2/2] exfat: unify name extraction

2020-08-11 Thread Tetsuhiro Kohada
next time and are no longer the "minimum cost". Should I add this to the commit-message? BR --- Tetsuhiro Kohada

Re: [PATCH 1/2] exfat: add NameLength check when extracting name

2020-08-11 Thread Tetsuhiro Kohada
g the name from Name dir-entries to extract correct name. And, change to get the information of file/stream-ext dir-entries via the member variable of exfat_entry_set_cache. ** This patch depends on: '[PATCH v3] exfat: integrates dir-entry getting and validation'. Signed-off-by: T

[PATCH 2/2] exfat: write only modified part of dir-entry set

2020-08-07 Thread Tetsuhiro Kohada
s dir-entry getting and validation' '[PATCH] exfat: add NameLength check when extracting name' '[PATCH] exfat: unify name extraction' Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 33 - fs/exfat/exfat_fs.h | 4 +--- fs/exfat

[PATCH 1/2] exfat: add dir-entry set checksum validation

2020-08-07 Thread Tetsuhiro Kohada
Add checksum validation for dir-entry set when getting it. exfat_calc_dir_chksum_with_entry_set() also validates entry-type. ** This patch depends on: '[PATCH v3] exfat: integrates dir-entry getting and validation' Signed-off-by: Tetsuhiro Kohada --- fs/exfat/

[PATCH 1/2] exfat: add NameLength check when extracting name

2020-08-05 Thread Tetsuhiro Kohada
hange to get the information of file/stream-ext dir-entries via the member variable of exfat_entry_set_cache. ** This patch depends on: '[PATCH v3] exfat: integrates dir-entry getting and validation'. Signed-off-by: Tetsuhiro Kohada --- fs/e

[PATCH 2/2] exfat: unify name extraction

2020-08-05 Thread Tetsuhiro Kohada
using exfat_entry_set_cache and exfat_get_uniname_from_name_entries(), like exfat_readdir(). And, remove unused functions/parameters. ** This patch depends on: '[PATCH v3] exfat: integrates dir-entry getting and validation'. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/d

[PATCH v3] exfat: integrates dir-entry getting and validation

2020-08-05 Thread Tetsuhiro Kohada
ries. Pre-Validated 'file' and 'stream-ext' dir-entries are provided as member variables of exfat_entry_set_cache. And, rename TYPE_EXTEND to TYPE_NAME. Suggested-by: Sungjong Seo Suggested-by: Namjae Jeon Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Change verificat

Re: [PATCH v2] exfat: integrates dir-entry getting and validation

2020-08-04 Thread Tetsuhiro Kohada
+ i = 2; + while ((ep = exfat_get_validated_dentry(es, i++, TYPE_NAME))) { As Sungjong said, I think that TYPE_NAME seems right to be validated in exfat_get_dentry_set(). First, it is possible to correctly determine that "Immediately follow the Stream Extension directory entry

[PATCH v2] exfat: retain 'VolumeFlags' properly

2020-07-30 Thread Tetsuhiro Kohada
ys ... Clear the value of the VolumeDirty field to 0, if its value prior to the first step was 0 Therefore, should not clear VolumeDirty when mounted. Also, rename ERR_MEDIUM to MEDIA_FAILURE. Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Add exfat_set_volume_dirty() & exfat_clear_volume_d

Re: [PATCH] exfat: retain 'VolumeFlags' properly

2020-07-30 Thread Tetsuhiro Kohada
On 2020/07/30 15:59, Namjae Jeon wrote: Ping.. Hi Tetsuhiro, Thank you for your reply. On 2020/07/15 19:06, Tetsuhiro Kohada wrote: It looks complicated. It would be better to simply set/clear VOLUME DIRTY bit. I think exfat_set_vol_flags() gets a little complicated, because it needs

Re: [PATCH] exfat: retain 'VolumeFlags' properly

2020-07-29 Thread Tetsuhiro Kohada
Ping.. On 2020/07/15 19:06, Tetsuhiro Kohada wrote: It looks complicated. It would be better to simply set/clear VOLUME DIRTY bit. I think exfat_set_vol_flags() gets a little complicated, because it needs the followings (with bit operation)  a) Set/Clear VOLUME_DIRTY.  b) Set MEDIA_FAILUR

Re: [PATCH v2] exfat: integrates dir-entry getting and validation

2020-07-29 Thread Tetsuhiro Kohada
On 2020/07/15 10:22, Tetsuhiro Kohada wrote: Add validation for num, bh and type on getting dir-entry. ('file' and 'stream-ext' dir-entries are pre-validated to ensure success) Renamed exfat_get_dentry_cached() to exfat_get_validated_dentry() due to a change in functional

Re: [PATCH] exfat: change exfat_set_vol_flags() return type void.

2020-07-16 Thread Tetsuhiro Kohada
buffer() is executed? BR --- Tetsuhiro Kohada

Re: [PATCH] exfat: retain 'VolumeFlags' properly

2020-07-15 Thread Tetsuhiro Kohada
OLUME_DIRTY. b) Set MEDIA_FAILUR. c) Do not change other flags. d) Retain VOLUME_DIRTY/MEDIA_FAILUR as it is when mounted. 'vol_flags_noclear' is used for d). Bit-by-bit operation makes the code redundant. I think it's not a bad way to handle multiple bits. What do you think? BR --- Tetsuhiro Kohada

[PATCH v2] exfat: integrates dir-entry getting and validation

2020-07-14 Thread Tetsuhiro Kohada
fied. This will also recognize a dir-entry set that contains 'benign secondary' dir-entries. And, rename TYPE_EXTEND to TYPE_NAME. Suggested-by: Sungjong Seo Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Change verification order - Verification loop start with index

Re: [PATCH v3] exfat: remove EXFAT_SB_DIRTY flag

2020-07-10 Thread Tetsuhiro Kohada
ere is no write operation. :-) sync-fs makes it clean and ejectable immidiately. :-( It remains dirty unless sync-fs or unmount. :-( Frequent sync-fs will increases writes to boot-sector. I think it should be (C) or(D). What do you think? BR --- Tetsuhiro Kohada

[PATCH] exfat: retain 'VolumeFlags' properly

2020-07-08 Thread Tetsuhiro Kohada
ys ... Clear the value of the VolumeDirty field to 0, if its value prior to the first step was 0 Therefore, should not clear VolumeDirty when mounted. Also, rename ERR_MEDIUM to MED_FAILURE. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/exfat_fs.h | 5 +++-- fs/exfat/exfat_raw.h | 2

[RFC]PATCH] exfat: integrates dir-entry getting and validation

2020-06-25 Thread Tetsuhiro Kohada
fied. This will also recognize a dir-entry set that contains 'benign secondary' dir-entries. And, rename TYPE_EXTEND to TYPE_NAME. Suggested-by: Sungjong Seo Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 144 ++-- fs/exfat/exfat_fs.

[PATCH v2] exfat: optimize exfat_zeroed_cluster()

2020-06-23 Thread Tetsuhiro Kohada
Replace part of exfat_zeroed_cluster() with exfat_update_bhs(). And remove exfat_sync_bhs(). Signed-off-by: Tetsuhiro Kohada --- Changes in v2 - Rebase to latest exfat-dev fs/exfat/fatent.c | 53 +-- 1 file changed, 10 insertions(+), 43 deletions

[PATCH 1/2 v5] exfat: write multiple sectors at once

2020-06-22 Thread Tetsuhiro Kohada
Write multiple sectors at once when updating dir-entries. Add exfat_update_bhs() for that. It wait for write completion once instead of sector by sector. It's only effective if sync enabled. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - Split into 'write multiple sectors at on

[PATCH 1/2 v4] exfat: write multiple sectors at once

2020-06-19 Thread Tetsuhiro Kohada
Write multiple sectors at once when updating dir-entries. Add exfat_update_bhs() for that. It wait for write completion once instead of sector by sector. It's only effective if sync enabled. Reviewed-by: Christoph Hellwig Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - Split into &

[PATCH 2/2 v4] exfat: add error check when updating dir-entries

2020-06-19 Thread Tetsuhiro Kohada
Add error check when synchronously updating dir-entries. Suggested-by: Sungjong Seo Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - Split into 'write multiple sectors at once' and 'add error check when updating dir-entries' Changes in v3 - Rebase to latest exf

Re: [PATCH v3] exfat: remove EXFAT_SB_DIRTY flag

2020-06-18 Thread Tetsuhiro Kohada
diaFailure is more appropriate. BR --- Tetsuhiro Kohada

Re: [PATCH v3] exfat: remove EXFAT_SB_DIRTY flag

2020-06-18 Thread Tetsuhiro Kohada
eared by 'sync'. Is my description insufficient? BTW Even with this patch applied, VOL_DIRTY remains until synced in the above case. It's not easy to reproduce as rmdir, but I'll try to fix it in the future. BR --- Tetsuhiro Kohada

[PATCH 1/2 v3] exfat: write multiple sectors at once

2020-06-17 Thread Tetsuhiro Kohada
Write multiple sectors at once when updating dir-entries. Add exfat_update_bhs() for that. It wait for write completion once instead of sector by sector. It's only effective if sync enabled. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - Split into 'write multiple sectors at on

[PATCH 2/2 v3] exfat: add error check when updating dir-entries

2020-06-17 Thread Tetsuhiro Kohada
Add error check when synchronously updating dir-entries. Suggested-by: Sungjong Seo Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - Split into 'write multiple sectors at once' and 'add error check when updating dir-entries' Changes in v3 - Rebase to latest exfat-

Re: [PATCH v2] exfat: remove EXFAT_SB_DIRTY flag

2020-06-15 Thread Tetsuhiro Kohada
eturn error without setting EXFAT_SB_DIRTY. If performe 'sync' in this state, VOL_DIRTY will not be cleared. Remove the EXFAT_SB_DIRTY check to ensure synchronization. And, remove the code related to the flag. Suggested-by: Sungjong Seo Signed-off-by: Tetsuhiro Kohada --

[PATCH v3] exfat: remove EXFAT_SB_DIRTY flag

2020-06-15 Thread Tetsuhiro Kohada
Y. If performe 'sync' in this state, VOL_DIRTY will not be cleared. Remove the EXFAT_SB_DIRTY check to ensure synchronization. And, remove the code related to the flag. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - exfat_sync_fs() avoids synchronous processing when wait=0 Change

[PATCH v2] exfat: remove EXFAT_SB_DIRTY flag

2020-06-15 Thread Tetsuhiro Kohada
Y. If performe 'sync' in this state, VOL_DIRTY will not be cleared. Remove the EXFAT_SB_DIRTY check to ensure synchronization. And, remove the code related to the flag. Suggested-by: Sungjong Seo Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - exfat_sync_fs() avoids synchronous

Re: [PATCH] exfat: remove EXFAT_SB_DIRTY flag

2020-06-12 Thread Tetsuhiro Kohada
eturn error without setting EXFAT_SB_DIRTY. If performe 'sync' in this state, VOL_DIRTY will not be cleared. Remove the EXFAT_SB_DIRTY check to ensure synchronization. And, remove the code related to the flag. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/balloc.c | 4 ++--

[PATCH] exfat: remove EXFAT_SB_DIRTY flag

2020-06-11 Thread Tetsuhiro Kohada
Y. If performe 'sync' in this state, VOL_DIRTY will not be cleared. Remove the EXFAT_SB_DIRTY check to ensure synchronization. And, remove the code related to the flag. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/balloc.c | 4 ++-- fs/exfat/dir.c | 16 fs/exfat/

Re: [PATCH 1/3] exfat: add error check when updating dir-entries

2020-06-09 Thread Tetsuhiro Kohada
en updating dir-entries'. The other two patches(2nd & 3rd) are no-changed, so have not been sent. If you need the other two patches, I will send them. In that case, please tell me how to write the subject and change-log. BR --- Tetsuhiro Kohada

[PATCH 2/2] exfat: add error check when updating dir-entries

2020-06-09 Thread Tetsuhiro Kohada
Add error check when synchronously updating dir-entries. Suggested-by: Namjae Jeon Suggested-by: Sungjong Seo Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - Split into 'write multiple sectors at once' and 'add error check when updating dir-entries' fs/exfat/di

[PATCH 1/2 v2] exfat: write multiple sectors at once

2020-06-09 Thread Tetsuhiro Kohada
Write multiple sectors at once when updating dir-entries. Add exfat_update_bhs() for that. It wait for write completion once instead of sector by sector. It's only effective if sync enabled. Suggested-by: Namjae Jeon Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - Split into &

[PATCH 2/3] exfat: optimize exfat_zeroed_cluster()

2020-06-04 Thread Tetsuhiro Kohada
Replace part of exfat_zeroed_cluster() with exfat_update_bhs(). And remove exfat_sync_bhs(). Signed-off-by: Tetsuhiro Kohada --- fs/exfat/fatent.c | 54 ++- 1 file changed, 11 insertions(+), 43 deletions(-) diff --git a/fs/exfat/fatent.c b/fs/exfat

[PATCH 1/3] exfat: add error check when updating dir-entries

2020-06-04 Thread Tetsuhiro Kohada
Add error check when synchronously updating dir-entries. Furthermore, add exfat_update_bhs(). It wait for write completion once instead of sector by sector. Suggested-by: Sungjong Seo Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 15 +-- fs/exfat/exfat_fs.h | 3 ++- fs

[PATCH 3/3] exfat: set EXFAT_SB_DIRTY and VOL_DIRTY at the same timing

2020-06-04 Thread Tetsuhiro Kohada
e cleared. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/balloc.c | 4 ++-- fs/exfat/dir.c | 18 -- fs/exfat/exfat_fs.h | 2 +- fs/exfat/fatent.c | 6 +- fs/exfat/misc.c | 3 +-- fs/exfat/namei.c| 12 ++-- fs/exfat/super.c| 3 +++ 7 files chan

[PATCH 3/4 v4] exfat: add boot region verification

2020-05-31 Thread Tetsuhiro Kohada
Add Boot-Regions verification specified in exFAT specification. Note that the checksum type is strongly related to the raw structure, so the'u32 'type is used to clarify the number of bits. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - rebase with patch 'optimize dir

[PATCH 3/4 v3] exfat: add boot region verification

2020-05-29 Thread Tetsuhiro Kohada
Add Boot-Regions verification specified in exFAT specification. Note that the checksum type is strongly related to the raw structure, so the'u32 'type is used to clarify the number of bits. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - rebase with patch 'optimize dir

[PATCH 2/4 v3] exfat: separate the boot sector analysis

2020-05-29 Thread Tetsuhiro Kohada
Separate the boot sector analysis to read_boot_sector(). And add a check for the fs_name field. Furthermore, add a strict consistency check, because overlapping areas can cause serious corruption. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - rebase with patch 'optimize dir-

[PATCH 4/4 v3] exfat: standardize checksum calculation

2020-05-29 Thread Tetsuhiro Kohada
To clarify that it is a 16-bit checksum, the parts related to the 16-bit checksum are renamed and change type to u16. Furthermore, replace checksum calculation in exfat_load_upcase_table() with exfat_calc_checksum32(). Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - rebase with patch

[PATCH 1/4 v3] exfat: redefine PBR as boot_sector

2020-05-29 Thread Tetsuhiro Kohada
Aggregate PBR related definitions and redefine as "boot_sector" to comply with the exFAT specification. And, rename variable names including 'pbr'. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - rebase with patch 'optimize dir-cache' applied Changes in v3:

Re: [PATCH 1/4] exfat: redefine PBR as boot_sector

2020-05-28 Thread Tetsuhiro Kohada
I'll make another small patch, OK? No, It make sense to make v3, because you have renamed the variables in boot_sector on this patch. OK. BTW I have a concern about fs_name. The exfat specification says that this field is "EXFAT". I think it's a important field for determining the filesyst

Re: [PATCH 1/4] exfat: redefine PBR as boot_sector

2020-05-28 Thread Tetsuhiro Kohada
[snip] +/* EXFAT: Main and Backup Boot Sector (512 bytes) */ struct boot_sector +{ + __u8jmp_boot[BOOTSEC_JUMP_BOOT_LEN]; + __u8oem_name[BOOTSEC_OEM_NAME_LEN]; According to the exFAT specification, fs_name and BOOTSEC_FS_NAME_LEN look better. Oops. I sent v2 patches, befor

Re: [PATCH 4/4] exfat: standardize checksum calculation

2020-05-28 Thread Tetsuhiro Kohada
I'll repost the patch, based on the dir-cache patched dev-tree. If dir-cache patch will merge into dev-tree, should I wait until then? I will apply them after testing at once if you send updated 5 patches again. I resend patches for boot_sector. However, the dir-cache patch hasn't changed, so I

[PATCH 4/4 v2] exfat: standardize checksum calculation

2020-05-28 Thread Tetsuhiro Kohada
To clarify that it is a 16-bit checksum, the parts related to the 16-bit checksum are renamed and change type to u16. Furthermore, replace checksum calculation in exfat_load_upcase_table() with exfat_calc_checksum32(). Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - rebase with patch

[PATCH 3/4 v2] exfat: add boot region verification

2020-05-28 Thread Tetsuhiro Kohada
Add Boot-Regions verification specified in exFAT specification. Note that the checksum type is strongly related to the raw structure, so the'u32 'type is used to clarify the number of bits. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - rebase with patch 'optimize dir

[PATCH 1/4 v2] exfat: redefine PBR as boot_sector

2020-05-28 Thread Tetsuhiro Kohada
Aggregate PBR related definitions and redefine as "boot_sector" to comply with the exFAT specification. And, rename variable names including 'pbr'. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - rebase with patch 'optimize dir-cache' applied fs/exfat

[PATCH 2/4 v2] exfat: separate the boot sector analysis

2020-05-28 Thread Tetsuhiro Kohada
Separate the boot sector analysis to read_boot_sector(). Furthermore, add a strict consistency check, because overlapping areas can cause serious corruption. Signed-off-by: Tetsuhiro Kohada --- Changes in v2: - rebase with patch 'optimize dir-cache' applied fs/exfat/exfat_raw.h

Re: [PATCH 4/4] exfat: standardize checksum calculation

2020-05-27 Thread Tetsuhiro Kohada
II tried applying patch to dev-tree (4c4dbb6ad8e8). -The .patch file I sent -mbox file downloaded from archive But I can't reproduce the error. (Both succeed) How do you reproduce the error? I tried to appy your patches in the following order. 1. [PATCH] exfat: optimize dir-cache 2. [PATCH 1/4] e

Re: [PATCH] exfat: optimize dir-cache

2020-05-27 Thread Tetsuhiro Kohada
> In order to prevent illegal accesses to bh and dentries, it would be better to check validation for num and bh. There is no new error checking for same reason as above. I'll try to add error checking to this v2 patch. Or is it better to add error checking in another patch? The latter:

Re: [PATCH 4/4] exfat: standardize checksum calculation

2020-05-27 Thread Tetsuhiro Kohada
Thank you for your comment. I can not apply this patch to exfat dev tree. Could you please check it ? patching file fs/exfat/dir.c Hunk #1 succeeded at 491 (offset -5 lines). Hunk #2 succeeded at 500 (offset -5 lines). Hunk #3 succeeded at 508 (offset -5 lines). Hunk #4 FAILED at 600. Hunk #5 su

[PATCH 3/4] exfat: add boot region verification

2020-05-25 Thread Tetsuhiro Kohada
Add Boot-Regions verification specified in exFAT specification. Note that the checksum type is strongly related to the raw structure, so the'u32 'type is used to clarify the number of bits. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/exfat_fs.h | 1 + fs/exfat/misc.

[PATCH 2/4] exfat: separate the boot sector analysis

2020-05-25 Thread Tetsuhiro Kohada
Separate the boot sector analysis to read_boot_sector(). Furthermore, add a strict consistency check, because overlapping areas can cause serious corruption. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/exfat_raw.h | 1 + fs/exfat/super.c | 96

[PATCH 4/4] exfat: standardize checksum calculation

2020-05-25 Thread Tetsuhiro Kohada
To clarify that it is a 16-bit checksum, the parts related to the 16-bit checksum are renamed and change type to u16. Furthermore, replace checksum calculation in exfat_load_upcase_table() with exfat_calc_checksum32(). Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 12

  1   2   >