Skip to contentSkip to conversation

Btrfs: remove pointless assertion on reclaim_size counter

PATCH In review [email protected] 3 participants 5 messages Apr 7, 2020 – Apr 8, 2020 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Btrfs: remove pointless assertion on reclaim_size counter

From: Filipe Manana <[email protected]>

The reclaim_size counter of a space_info object is unsigned. So its value can never be negative, it's pointless to have an assertion that checks its value is >= 0, therefore remove it.

---
 fs/btrfs/space-info.c | 1 -
 1 file changed, 1 deletion(-)
fs/btrfs/space-info.c +0 -1
index ff17a4420358..88d7dea215ff 100644
@@ -1198,7 +1198,6 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
 	 * the list and we will do our own flushing further down.
 	 */
 	if (ret && flush != BTRFS_RESERVE_NO_FLUSH) {
-		ASSERT(space_info->reclaim_size >= 0);
 		ticket.bytes = orig_bytes;
 		ticket.error = 0;
 		space_info->reclaim_size += ticket.bytes;
Signature · 1 line
2.11.0
Reviewed-by on v1 2/2
#1 lore raw
Quoted 7 lines · On 7.04.20 г. 13:38 ч., [email protected] wrote:

From: Filipe Manana <[email protected]>

The reclaim_size counter of a space_info object is unsigned. So its value can never be negative, it's pointless to have an assertion that checks its value is >= 0, therefore remove it.

True,

squashed.

Quoted 17 lines
---
 fs/btrfs/space-info.c | 1 -
 1 file changed, 1 deletion(-)
fs/btrfs/space-info.c +0 -1
index ff17a4420358..88d7dea215ff 100644
@@ -1198,7 +1198,6 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
 	 * the list and we will do our own flushing further down.
 	 */
 	if (ret && flush != BTRFS_RESERVE_NO_FLUSH) {
-		ASSERT(space_info->reclaim_size >= 0);
 		ticket.bytes = orig_bytes;
 		ticket.error = 0;
 		space_info->reclaim_size += ticket.bytes;
#2 lore raw
Quoted 10 lines · Nikolay Borisov
Quoted 6 lines · On 7.04.20 г. 13:38 ч., [email protected] wrote:

From: Filipe Manana <[email protected]>

The reclaim_size counter of a space_info object is unsigned. So its value can never be negative, it's pointless to have an assertion that checks its value is >= 0, therefore remove it.

Quoted 6 lines
Quoted 1 line

True,

squashed.

Despite being a trivial and small change, I don't think it should be squashed into the previous patch, as it's not part of the bug fix regarding the counter leak.
Different changes and unrelated changes should be separate patches.

Thanks.

Quoted 18 lines
Quoted 18 lines
---
 fs/btrfs/space-info.c | 1 -
 1 file changed, 1 deletion(-)
fs/btrfs/space-info.c +0 -1
index ff17a4420358..88d7dea215ff 100644
@@ -1198,7 +1198,6 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
       * the list and we will do our own flushing further down.
       */
      if (ret && flush != BTRFS_RESERVE_NO_FLUSH) {
-             ASSERT(space_info->reclaim_size >= 0);
              ticket.bytes = orig_bytes;
              ticket.error = 0;
              space_info->reclaim_size += ticket.bytes;
#3 lore raw
Quoted 15 lines · Filipe Manana
Quoted 14 lines · Nikolay Borisov
Quoted 7 lines · On 7.04.20 г. 13:38 ч., [email protected] wrote:

From: Filipe Manana <[email protected]>

The reclaim_size counter of a space_info object is unsigned. So its value can never be negative, it's pointless to have an assertion that checks its value is >= 0, therefore remove it.

True,

Quoted 7 lines
Quoted 2 lines

squashed.

Despite being a trivial and small change, I don't think it should be squashed into the previous patch, as it's not part of the bug fix regarding the counter leak.
Different changes and unrelated changes should be separate patches.

I meant to say squashed into the original commit that introduced the assert but it seems it has already been merged into master so yeah, it will go as it is.