Skip to contentSkip to conversation

Correct a comment error

PATCH In review Larry Chen 3 participants 9 messages Feb 28, 2018 – Mar 2, 2018 OCFS2

lore
Share & tools
lore

Larry Chen

author
#0 lore raw

PATCH 1/1 Correct a comment error

The function ocfs2_double_lock tries to lock the inode with lower blockid first, not lockid.

---
 fs/ocfs2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
index c801eddc4bf3..30d454de35a8 100644
@@ -1133,7 +1133,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
 	if (*bh2)
 		*bh2 = NULL;
 
-	/* we always want to lock the one with the lower lockid first.
+	/* we always want to lock the one with the lower blockid first.
 	 * and if they are nested, we lock ancestor first */
 	if (oi1->ip_blkno != oi2->ip_blkno) {
 		inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno,
Signature · 1 line
2.13.6
#1 lore raw

Hi Larry,

Quoted 2 lines · Larry Chen

The function ocfs2_double_lock tries to lock the inode with lower blockid first, not lockid.

As ocfs2's lock name includes block number, so I think the comment you want to rework is all right.
So nack.

Thanks,
Changwei

Quoted 20 lines
---
  fs/ocfs2/namei.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
index c801eddc4bf3..30d454de35a8 100644
@@ -1133,7 +1133,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
  	if (*bh2)
  		*bh2 = NULL;
 
-	/* we always want to lock the one with the lower lockid first.
+	/* we always want to lock the one with the lower blockid first.
  	 * and if they are nested, we lock ancestor first */
  	if (oi1->ip_blkno != oi2->ip_blkno) {
  		inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno,
author
#2 lore raw

Hi Changwei,

Thanks for your review.

I think the original comment is not as clear as you said since the code does not reflect any relation between lockid and blockid.

Besides, the function inside indeed uses the block number for comparision. And it's really misleading for new beginners ,emmmm, like me.

:)

Thanks,
Larry

Quoted 1 line
Quoted 1 line
Quoted 1 line

Changwei Ge <[email protected]> 2018-3-1 ?? 8:37 >>>

Hi Larry,

Quoted 2 lines · Larry Chen

The function ocfs2_double_lock tries to lock the inode with lower blockid first, not lockid.

As ocfs2's lock name includes block number, so I think the comment you want to rework is all right.
So nack.

Thanks,
Changwei

Quoted 12 lines
---
  fs/ocfs2/namei.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +0 -0
index c801eddc4bf3..30d454de35a8 100644

fs/ocfs2/namei.c static int ocfs2_double_lock(struct ocfs2_super *osb, · line 1139

Quoted 8 lines
fs/ocfs2/namei.c +1 -1
@@ -1133,7 +1133,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
      if (*bh2)
          *bh2 = NULL;
 
-    /* we always want to lock the one with the lower lockid first.
+    /* we always want to lock the one with the lower blockid first.
       * and if they are nested, we lock ancestor first */
      if (oi1->ip_blkno != oi2->ip_blkno) {
          inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20180228/db74a027/attachment.html

#3 lore raw
Quoted 9 lines · Lei Chen

Hi Changwei,

Thanks for your review.

I think the original comment is not as clear as you said since the code does not reflect any relation between lockid and blockid.

Besides, the function inside indeed uses the block number for comparision. And it's really misleading for new beginners ,emmmm, like me.

It's OK. Any behavior to fix, improve ocfs2 is encouraged.

-Changwei

Quoted 45 lines

:)

Thanks,
Larry

Quoted 1 line
Quoted 1 line
Quoted 1 line

Changwei?Ge?<[email protected]> 2018-3-1 ?? 8:37 >>>

Hi Larry,

Quoted 2 lines · Larry Chen

The function ocfs2_double_lock tries to lock the inode with lower blockid first, not lockid.

As ocfs2's lock name includes block number, so I think the comment you want to rework is all right.
So nack.

Thanks,
Changwei

Quoted 20 lines

---
fs/ocfs2/namei.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
index c801eddc4bf3..30d454de35a8 100644
@@ -1133,7 +1133,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
 ????if (*bh2)
 ????????*bh2 = NULL;
 
-????/* we always want to lock the one with the lower lockid first.
+????/* we always want to lock the one with the lower blockid first.

???? * and if they are nested, we lock ancestor first */ ????if (oi1->ip_blkno != oi2->ip_blkno) { ????????inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno,

#4 lore raw
In reply to Larry Chen

Hi Larry,

There is the same mistake in ocfs2_reflink_inodes_lock(), could you help fixing them all?

thanks,
Jun

Quoted 22 lines · Larry Chen

The function ocfs2_double_lock tries to lock the inode with lower blockid first, not lockid.

---
 fs/ocfs2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
index c801eddc4bf3..30d454de35a8 100644
@@ -1133,7 +1133,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
 	if (*bh2)
 		*bh2 = NULL;
 
-	/* we always want to lock the one with the lower lockid first.
+	/* we always want to lock the one with the lower blockid first.
 	 * and if they are nested, we lock ancestor first */
 	if (oi1->ip_blkno != oi2->ip_blkno) {
 		inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno,
#5 lore raw

Hi Jun,
I think the comments for both two functions are OK.
No need to rework them.
As we know, ocfs2 lock name(lock id) are composed of several parts including block number.

Thanks,
Changw2ei

Quoted 37 lines · piaojun

Hi Larry,

There is the same mistake in ocfs2_reflink_inodes_lock(), could you help fixing them all?

thanks,
Jun

Quoted 14 lines · Larry Chen

The function ocfs2_double_lock tries to lock the inode with lower blockid first, not lockid.

---
  fs/ocfs2/namei.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +0 -0
index c801eddc4bf3..30d454de35a8 100644

fs/ocfs2/namei.c static int ocfs2_double_lock(struct ocfs2_super *osb, · line 1139

Quoted 8 lines
fs/ocfs2/namei.c +1 -1
@@ -1133,7 +1133,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
  	if (*bh2)
  		*bh2 = NULL;
 
-	/* we always want to lock the one with the lower lockid first.
+	/* we always want to lock the one with the lower blockid first.
  	 * and if they are nested, we lock ancestor first */
  	if (oi1->ip_blkno != oi2->ip_blkno) {
  		inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno,

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

#6 lore raw

Hi Changwei,

Quoted 5 lines · Changwei Ge

Hi Jun,
I think the comments for both two functions are OK.
No need to rework them.
As we know, ocfs2 lock name(lock id) are composed of several parts including block number.

I looked though the comments involved 'lockid', and found 'lockid' is a concept in dlm level, so ocfs2 level should not be aware of it.

thanks,
Jun

Quoted 44 lines

Thanks,
Changw2ei

Quoted 25 lines · piaojun

Hi Larry,

There is the same mistake in ocfs2_reflink_inodes_lock(), could you help fixing them all?

thanks,
Jun

Quoted 16 lines · Larry Chen

The function ocfs2_double_lock tries to lock the inode with lower blockid first, not lockid.

---
  fs/ocfs2/namei.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +0 -0
index c801eddc4bf3..30d454de35a8 100644
@@ -1133,7 +1133,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
  	if (*bh2)
  		*bh2 = NULL;
 
Quoted 12 lines

fs/ocfs2/namei.c static int ocfs2_double_lock(struct ocfs2_super *osb, · line 1139

Quoted 6 lines
fs/ocfs2/namei.c +1 -1
-	/* we always want to lock the one with the lower lockid first.
+	/* we always want to lock the one with the lower blockid first.
  	 * and if they are nested, we lock ancestor first */
  	if (oi1->ip_blkno != oi2->ip_blkno) {
  		inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno,

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

.

author
#7 lore raw

Hi Changwei and Jun,

Thanks for your advice.

Quoted 10 lines · piaojun

Hi Changwei,

Quoted 5 lines · Changwei Ge

Hi Jun,
I think the comments for both two functions are OK.
No need to rework them.
As we know, ocfs2 lock name(lock id) are composed of several parts including block number.

I looked though the comments involved 'lockid', and found 'lockid' is a concept in dlm level, so ocfs2 level should not be aware of it.

When reading source code of ocfs2 level, you'll find that 'lockid' is a new concept that has not occurred or be explained before.

It's kind of difficult to understand.

Maybe 'blockno' or 'blockid' is more sensible than 'lockid'

I'm willing to fix them all.

Thanks
Larry

Quoted 44 lines

thanks,
Jun

Quoted 42 lines

Thanks,
Changw2ei

Quoted 25 lines · piaojun

Hi Larry,

There is the same mistake in ocfs2_reflink_inodes_lock(), could you help fixing them all?

thanks,
Jun

Quoted 16 lines · Larry Chen

The function ocfs2_double_lock tries to lock the inode with lower blockid first, not lockid.

---
   fs/ocfs2/namei.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +0 -0
index c801eddc4bf3..30d454de35a8 100644
@@ -1133,7 +1133,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
   	if (*bh2)
   		*bh2 = NULL;
 
Quoted 11 lines

fs/ocfs2/namei.c static int ocfs2_double_lock(struct ocfs2_super *osb, · line 1139

Quoted 6 lines
fs/ocfs2/namei.c +1 -1
-	/* we always want to lock the one with the lower lockid first.
+	/* we always want to lock the one with the lower blockid first.
   	 * and if they are nested, we lock ancestor first */
   	if (oi1->ip_blkno != oi2->ip_blkno) {
   		inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno,

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

.

#8 lore raw
In reply to piaojun

Hi Jun,

Quoted 10 lines · piaojun

Hi Changwei,

Quoted 5 lines · Changwei Ge

Hi Jun,
I think the comments for both two functions are OK.
No need to rework them.
As we know, ocfs2 lock name(lock id) are composed of several parts including block number.

I looked though the comments involved 'lockid', and found 'lockid' is a concept in dlm level, so ocfs2 level should not be aware of it.

I don't agree.
Please refer to ocfs2_build_lock_name().
DLM should not know how ocfs2 distinguishes objects it wants to protected. Moreover, ocfs2 has a abstraction layer called dlmglue.

-Changwei

Quoted 48 lines

thanks,
Jun

Quoted 44 lines

Thanks,
Changw2ei

Quoted 25 lines · piaojun

Hi Larry,

There is the same mistake in ocfs2_reflink_inodes_lock(), could you help fixing them all?

thanks,
Jun

Quoted 16 lines · Larry Chen

The function ocfs2_double_lock tries to lock the inode with lower blockid first, not lockid.

---
   fs/ocfs2/namei.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +0 -0
index c801eddc4bf3..30d454de35a8 100644
@@ -1133,7 +1133,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
   	if (*bh2)
   		*bh2 = NULL;
 
Quoted 12 lines

fs/ocfs2/namei.c static int ocfs2_double_lock(struct ocfs2_super *osb, · line 1139

Quoted 6 lines
fs/ocfs2/namei.c +1 -1
-	/* we always want to lock the one with the lower lockid first.
+	/* we always want to lock the one with the lower blockid first.
   	 * and if they are nested, we lock ancestor first */
   	if (oi1->ip_blkno != oi2->ip_blkno) {
   		inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno,

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

.