Ocfs2: __ocfs2_find_path() needs to treat hole correctly.
PATCH 1/1 Ocfs2: __ocfs2_find_path() needs to treat hole correctly.
Currently, __ocfs2_find_path() was lack of a mechanism to detect a hole between two extent blocks if the cpos we want to search is within the hole, as a result, the last rec will be returned incorrectly.
This patch attempts to detect a hole, and return the rightmost extent block preceding the hole.
--- fs/ocfs2/alloc.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
fs/ocfs2/alloc.c +11 -0
@@ -1841,6 +1841,17 @@ static int __ocfs2_find_path(struct ocfs2_caching_info *ci,ocfs2_rec_clusters (el, rec);if (cpos >=le32_to_cpu (rec->e_cpos) && cpos < range)break ; + +/* +* Return the rightmost extent block leftly adjacent +* to a hole if there is any between two extent blocks. +* +* Otherwise, we get the last rec of this block unexpectly. +*/ +if (cpos <le32_to_cpu (rec->e_cpos)) { + i--; +break ; + } } blkno =le64_to_cpu (el->l_recs[i].e_blkno);
Signature · 1 line
1.5.5
PATCH 1/1 Ocfs2: __ocfs2_find_path() needs to treat hole correctly.
Quoted 4 lines · Tristan Ye
Currently,
__ocfs2_find_path()was lack of a mechanism to detect a hole between two extent blocks if the cpos we want to search is within the hole, as a result, the last rec will be returned incorrectly.
Do you mean extent block or extent rec? The extent block are contiguous and there should be no hole.
oh, here. We should never meet with this. So Nack.
Regards,
Tao
Quoted 32 lines
This patch attempts to detect a hole, and return the rightmost extent block preceding the hole.
Signed-off-by Tristan Ye <[email protected]>--- fs/ocfs2/alloc.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)fs/ocfs2/alloc.c +11
-0@@ -1841,6 +1841,17 @@ static int __ocfs2_find_path(struct ocfs2_caching_info *ci,ocfs2_rec_clusters (el, rec);if (cpos >=le32_to_cpu (rec->e_cpos) && cpos < range)break ; + +/* +* Return the rightmost extent block leftly adjacent +* to a hole if there is any between two extent blocks. +* +* Otherwise, we get the last rec of this block unexpectly. +*/ +if (cpos <le32_to_cpu (rec->e_cpos)) { + i--; +break ; + } } blkno =le64_to_cpu (el->l_recs[i].e_blkno);
PATCH 1/1 Ocfs2: __ocfs2_find_path() needs to treat hole correctly.
Quoted 8 lines · Tao Ma
Quoted 4 lines · Tristan Ye
Currently,
__ocfs2_find_path()was lack of a mechanism to detect a hole between two extent blocks if the cpos we want to search is within the hole, as a result, the last rec will be returned incorrectly.Do you mean extent block or extent rec? The extent block are contiguous and there should be no hole.
oh, here. We should never meet with this. So Nack.
I meant the extent records in none-leaf extent blocks, may the hole exist between these recs?
Tristan.
Quoted 36 lines
Regards,
TaoQuoted 32 lines
This patch attempts to detect a hole, and return the rightmost
extent block preceding the hole.Signed-off-by Tristan Ye <[email protected]>--- fs/ocfs2/alloc.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)fs/ocfs2/alloc.c +11
-0@@ -1841,6 +1841,17 @@ static int __ocfs2_find_path(structocfs2_caching_info *ci,ocfs2_rec_clusters (el ,rec );if (cpos >=le32_to_cpu (rec->e_cpos) && cpos < range)break ; + +/* +* Return the rightmost extent block leftly adjacent +* to a hole if there is any between two extent blocks. +* +* Otherwise, we get the last rec of this block unexpectly. +*/ +if (cpos <le32_to_cpu (rec->e_cpos)) { + i--; +break ; + } }blkno = le64_to_cpu(el->l_recs[i].e_blkno);
PATCH 1/1 Ocfs2: __ocfs2_find_path() needs to treat hole correctly.
Quoted 6 lines · tristan
Quoted 5 lines · Tao Ma
Quoted 4 lines · Tristan Ye
Currently,
__ocfs2_find_path()was lack of a mechanism to detect a hole between two extent blocks if the cpos we want to search is within the hole, as a result, the last rec will be returned incorrectly.
Quoted 6 lines
Quoted 3 lines
Do you mean extent block or extent rec? The extent block are contiguous and there should be no hole.
oh, here. We should never meet with this. So Nack.I meant the extent records in none-leaf extent blocks, may the hole exist between these recs?
no, there is no holes except the leaf extent rec.
Regards,
Tao
Quoted 42 lines
Tristan.
Quoted 36 lines
Regards,
TaoQuoted 32 lines
This patch attempts to detect a hole, and return the rightmost
extent block preceding the hole.Signed-off-by Tristan Ye <[email protected]>--- fs/ocfs2/alloc.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)fs/ocfs2/alloc.c +11
-0@@ -1841,6 +1841,17 @@ static int __ocfs2_find_path(structocfs2_caching_info *ci,ocfs2_rec_clusters (el ,rec );if (cpos >=le32_to_cpu (rec->e_cpos) && cpos < range)break ; + +/* +* Return the rightmost extent block leftly adjacent +* to a hole if there is any between two extent blocks. +* +* Otherwise, we get the last rec of this block unexpectly. +*/ +if (cpos <le32_to_cpu (rec->e_cpos)) { + i--; +break ; + } }blkno = le64_to_cpu(el->l_recs[i].e_blkno);
PATCH 1/1 Ocfs2: __ocfs2_find_path() needs to treat hole correctly.
Quoted 10 lines · Tao Ma
Quoted 7 lines · tristan
Quoted 6 lines · Tao Ma
Quoted 5 lines · Tristan Ye
Currently,
__ocfs2_find_path()was lack of a mechanism to detect a hole between two extent blocks if the cpos we want to search is within the hole, as a result, the last rec will be returned incorrectly.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Do you mean extent block or extent rec? The extent block are contiguous and there should be no hole.
oh, here. We should never meet with this. So Nack.I meant the extent records in none-leaf extent blocks, may the hole exist between these recs?
no, there is no holes except the leaf extent rec.
Gotcha,
Thanks for teaching;) I thought there may be a bug along with my punching hole patch, seems that is fine...
Quoted 46 lines
Regards,
TaoQuoted 43 lines
Tristan.
Quoted 37 lines
Regards,
TaoQuoted 33 lines
This patch attempts to detect a hole, and return the rightmost
extent block preceding the hole.Signed-off-by Tristan Ye <[email protected]>--- fs/ocfs2/alloc.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)fs/ocfs2/alloc.c +6
-0@@ -1841,6 +1841,17 @@ static int __ocfs2_find_path(structocfs2_caching_info *ci,ocfs2_rec_clusters (el ,rec );if (cpos >=le32_to_cpu (rec->e_cpos) && cpos < range)break ; + +/* +* Return the rightmost extent block leftly adjacent +* to a hole if there is any between two extent blocks. +* +* Otherwise, we get the last rec of this block unexpectly.
fs/ocfs2/alloc.c +5
-0+*/ +if (cpos <le32_to_cpu (rec->e_cpos)) { + i--; +break ; + } } blkno =le64_to_cpu (el->l_recs[i].e_blkno);