On 2019/9/30 下午9:34, Nikolay Borisov wrote: > > > On 30.09.19 г. 15:24 ч., Qu Wenruo wrote: >> Yes, the ASSERT() doesn't make much sense by itself. >> >> However I still believe it won't be a problem. > > It won't be a problem but it feels wrong to have this assert this deep > into the call chain. IMO It should be put where it can trigger at the > earliest which seems to be in check_inode_item. That function assumes > it's working with an inode item and goes to dereference inode members so > if the type is wrong we'd crash there instead of in repair_inode_gen_lowmem. This is going to be a preference thing. To my taste, if possible, I would put ASSERT() in every function with more than 24 lines, as an alternative to comment, to show the prerequisite or the assumption. Thanks, Qu > >> >> It's compiler's job to remove such dead ASSERT(), but for human reader, >> I still believe this ASSERT() could still make sense, especially when >> the caller or callee can get more and more complex. >> >> Thanks,
- [PATCH 0/3] btrfs-progs: Add check and repair for invalid ... Qu Wenruo
- [PATCH 2/3] btrfs-progs: check/original: Add check an... Qu Wenruo
- Re: [PATCH 2/3] btrfs-progs: check/original: Add ... Nikolay Borisov
- [PATCH 1/3] btrfs-progs: check/lowmem: Add check and ... Qu Wenruo
- Re: [PATCH 1/3] btrfs-progs: check/lowmem: Add ch... Nikolay Borisov
- Re: [PATCH 1/3] btrfs-progs: check/lowmem: Ad... Qu Wenruo
- Re: [PATCH 1/3] btrfs-progs: check/lowmem... Nikolay Borisov
- Re: [PATCH 1/3] btrfs-progs: check/l... Qu Wenruo
- [PATCH 3/3] btrfs-progs: fsck-tests: Add test image f... Qu Wenruo
- Re: [PATCH 0/3] btrfs-progs: Add check and repair for... Ferry Toth
- Re: [PATCH 0/3] btrfs-progs: Add check and repair... Qu WenRuo
- Re: [PATCH 0/3] btrfs-progs: Add check and re... Ferry Toth
- Re: [PATCH 0/3] btrfs-progs: Add check an... Qu Wenruo
- Re: [PATCH 0/3] btrfs-progs: Add che... Qu Wenruo
- Re: [PATCH 0/3] btrfs-progs: Add... Ferry Toth
- Re: [PATCH 0/3] btrfs-progs:... Qu WenRuo
- Re: [PATCH 0/3] btrfs-progs:... Ferry Toth
- Re: [PATCH 0/3] btrfs-progs:... Qu Wenruo