Closed ganghe closed 3 years ago
Compared with the last version, I add ocfs2_delete_dx_root() function in some early failure cases to recycle dx_root block.
Compared with the last version, I add ocfs2_delete_dx_root() function in some early failure cases to recycle dx_root block.
I don't think this is necessary since ocfs2_dx_dir_truncate() will do it.
Compared with the last version, I add ocfs2_delete_dx_root() function in some early failure cases to recycle dx_root block.
I don't think this is necessary since ocfs2_dx_dir_truncate() will do it.
Since the code will not call ocfs2_dx_dir_truncate() when the failure happens in the begin of the function.
IC. Can we add a new label? e.g.
int truncated = 0; ......
if (ret) goto delete; ...... trunc_out: if (ret) { ocfs2_dx_dir_truncate(fs, dir); truncated = 1; }
delete: if (ret && !truncated) ocfs2_delete_dx_root(fs, dr_blkno); ......
IC. Can we add a new label? e.g.
int truncated = 0; ......
if (ret) goto delete; ...... trunc_out: if (ret) { ocfs2_dx_dir_truncate(fs, dir); truncated = 1; }
delete: if (ret && !truncated) ocfs2_delete_dx_root(fs, dr_blkno); ......
Theoretically,adding a new tag like above has the same effect with the patch. but, I prefer to add more line ocfs2_delete_dx_root() functions to make the code logic more clear. Otherwise, the code in the end part of function looks a bit confused.
Okay, both are fine to me. Reviewed-by: Joseph Qi joseph.qi@linux.alibaba.com
When we try to create a directory index tree, we should truncate the directory index tree if this creation failed for some reason, e.g. there is not any more blocks to allocate. Otherwise, the file was attached a problematic directory index tree, this index will affect file lookup under this directory file.