Skip to contentSkip to conversation

btrfs: qgroup: delete a todo about using kmem cache to alloc structure

PATCH In review Junchao Sun 3 participants 8 messages May 28, 2024 – May 30, 2024 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: qgroup: delete a todo about using kmem cache to alloc structure

Generic slub works fine so far. And it's not necessary to create a dedicated kmem cache and leave it unused if quotas are disabled. So let's delete the todo line.

---
 fs/btrfs/qgroup.h | 1 -
 1 file changed, 1 deletion(-)
fs/btrfs/qgroup.h +0 -1
index 706640be0ec2..7874c972029c 100644
@@ -123,7 +123,6 @@ struct btrfs_inode;
 
 /*
  * Record a dirty extent, and info qgroup to update quota on it
- * TODO: Use kmem cache to alloc it.
  */
 struct btrfs_qgroup_extent_record {
 	struct rb_node node;
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Junchao Sun

Generic slub works fine so far. And it's not necessary to create a dedicated kmem cache and leave it unused if quotas are disabled. So let's delete the todo line.

My bad, at the time of writing I didn't notice that qgroup is not always enabled.
Furthermore nowadays squota won't utilize that structure either, making it less meaningful to go kmemcache.

Thanks,
Qu

Quoted 16 lines
---
  fs/btrfs/qgroup.h | 1 -
  1 file changed, 1 deletion(-)
fs/btrfs/qgroup.h +0 -1
index 706640be0ec2..7874c972029c 100644
@@ -123,7 +123,6 @@ struct btrfs_inode;
 
  /*
   * Record a dirty extent, and info qgroup to update quota on it
- * TODO: Use kmem cache to alloc it.
   */
  struct btrfs_qgroup_extent_record {
  	struct rb_node node;
#2 lore raw
Quoted 8 lines · Qu Wenruo <[email protected]> 于2024年5月28日周二 14:42写道:
Quoted 4 lines · Junchao Sun

Generic slub works fine so far. And it's not necessary to create a dedicated kmem cache and leave it unused if quotas are disabled. So let's delete the todo line.

Quoted 9 lines
Quoted 1 line

My bad, at the time of writing I didn't notice that qgroup is not always enabled.

Quoted 2 lines

Furthermore nowadays squota won't utilize that structure either, making it less meaningful to go kmemcache.

Thank you for your further explanation. By the way, is there anything meaningful todo? I saw some in code, but I can't ensure if they are still meaningful. I'd like to try contributing to btrfs and improve my understanding of it.
Also, is it a meaningful to view the contents of snapshots without rolling them back? The company I work for is considering implementing it recently...

Quoted 19 lines

Thanks,
Qu

Quoted 16 lines
---
  fs/btrfs/qgroup.h | 1 -
  1 file changed, 1 deletion(-)
fs/btrfs/qgroup.h +0 -1
index 706640be0ec2..7874c972029c 100644
@@ -123,7 +123,6 @@ struct btrfs_inode;
 
  /*
   * Record a dirty extent, and info qgroup to update quota on it
- * TODO: Use kmem cache to alloc it.
   */
  struct btrfs_qgroup_extent_record {
      struct rb_node node;
#3 lore raw
Quoted 16 lines · JunChao Sun
Quoted 15 lines · Qu Wenruo <[email protected]> 于2024年5月28日周二 14:42写道:
Quoted 5 lines · Junchao Sun

Generic slub works fine so far. And it's not necessary to create a dedicated kmem cache and leave it unused if quotas are disabled. So let's delete the todo line.

My bad, at the time of writing I didn't notice that qgroup is not always enabled.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

Furthermore nowadays squota won't utilize that structure either, making it less meaningful to go kmemcache.

Thank you for your further explanation. By the way, is there anything meaningful todo? I saw some in code, but I can't ensure if they are still meaningful. I'd like to try contributing to btrfs and improve my understanding of it.

You could find TODO or XXX marks in the sources but I'm against tracking todos like that and the one you saw and all the others are from old times. All are to be removed, though with evaluation if they apply and are still worth to be tracked by other means.

We don't have one place to track todos also things are more like an idea than a full fledged task with specification and agreement that this is what we want to do. This means it's better to talk to us first if you'd like to implement something, either privately by mail or you can join slack.

Otherwise generic contributions are always welcome, with perhaps a friendly warning that the code base is old and there are several people working on it so the style and coding patterns are kind of alwyas standing in the way. Reading code first to get the idea is recommended.

Quoted 3 lines

Also, is it a meaningful to view the contents of snapshots without rolling them back? The company I work for is considering implementing it recently...

This sounds like a use case that's above the filesystem, eg. rollback of snapshot I know of is done by snapper, what btrfs does is just to provide the capability of snapshots. Viewing snapshots is possible, either going to its directory or mounting it to some path and examining it.

#4 lore raw
Quoted 25 lines · David Sterba <[email protected]> 于2024年5月29日周三 23:12写道:
Quoted 16 lines · JunChao Sun
Quoted 15 lines · Qu Wenruo <[email protected]> 于2024年5月28日周二 14:42写道:
Quoted 5 lines · Junchao Sun

Generic slub works fine so far. And it's not necessary to create a dedicated kmem cache and leave it unused if quotas are disabled. So let's delete the todo line.

My bad, at the time of writing I didn't notice that qgroup is not always enabled.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

Furthermore nowadays squota won't utilize that structure either, making it less meaningful to go kmemcache.

Thank you for your further explanation. By the way, is there anything meaningful todo? I saw some in code, but I can't ensure if they are still meaningful. I'd like to try contributing to btrfs and improve my understanding of it.

Quoted 16 lines

You could find TODO or XXX marks in the sources but I'm against tracking todos like that and the one you saw and all the others are from old times. All are to be removed, though with evaluation if they apply and are still worth to be tracked by other means.

Quoted 10 lines

We don't have one place to track todos also things are more like an idea than a full fledged task with specification and agreement that this is what we want to do. This means it's better to talk to us first if you'd like to implement something, either privately by mail or you can join slack.

Otherwise generic contributions are always welcome, with perhaps a friendly warning that the code base is old and there are several people working on it so the style and coding patterns are kind of alwyas standing in the way. Reading code first to get the idea is recommended.

I see. Thanks for your detailed explanation.

Quoted 11 lines
Quoted 11 lines

Also, is it a meaningful to view the contents of snapshots without rolling them back? The company I work for is considering implementing it recently...

This sounds like a use case that's above the filesystem, eg. rollback of snapshot I know of is done by snapper, what btrfs does is just to provide the capability of snapshots. Viewing snapshots is possible, either going to its directory or mounting it to some path and examining it.

#5 lore raw
In reply to JunChao Sun
Quoted 1 line · JunChao Sun

Qu Wenruo <[email protected]> 于2024年5月28日周二 14:42写道:

[...]

Quoted 6 lines
Quoted 6 lines

My bad, at the time of writing I didn't notice that qgroup is not always enabled.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

Furthermore nowadays squota won't utilize that structure either, making it less meaningful to go kmemcache.

Thank you for your further explanation. By the way, is there anything meaningful todo? I saw some in code, but I can't ensure if they are still meaningful. I'd like to try contributing to btrfs and improve my understanding of it.

In fact I'm considering converting btrfs_qgroup_extent_record::node to XArray, inspired by the recent conversion by Filipe for btrfs_root::inodes.

Which should reduce the memory usage for btrfs_qgroup_extent_record.

Quoted 3 lines

Also, is it a meaningful to view the contents of snapshots without rolling them back? The company I work for is considering implementing it recently...

What do you mean by rolling back?

IIRC one can always access the snapshot from parent subvolume, or just mount the snapshot.

Thanks,
Qu

Quoted 20 lines
Quoted 19 lines

Thanks,
Qu

Quoted 16 lines
---
   fs/btrfs/qgroup.h | 1 -
   1 file changed, 1 deletion(-)
fs/btrfs/qgroup.h +0 -1
index 706640be0ec2..7874c972029c 100644
@@ -123,7 +123,6 @@ struct btrfs_inode;
 
   /*
    * Record a dirty extent, and info qgroup to update quota on it
- * TODO: Use kmem cache to alloc it.
    */
   struct btrfs_qgroup_extent_record {
       struct rb_node node;
#6 lore raw
Quoted 20 lines · Qu Wenruo <[email protected]> 于2024年5月30日周四 05:55写道:
Quoted 1 line · JunChao Sun

Qu Wenruo <[email protected]> 于2024年5月28日周二 14:42写道:

[...]

Quoted 12 lines
Quoted 8 lines

My bad, at the time of writing I didn't notice that qgroup is not always enabled.

Quoted 2 lines

Furthermore nowadays squota won't utilize that structure either, making it less meaningful to go kmemcache.

Thank you for your further explanation. By the way, is there anything meaningful todo? I saw some in code, but I can't ensure if they are still meaningful. I'd like to try contributing to btrfs and improve my understanding of it.

Quoted 4 lines
Quoted 4 lines

In fact I'm considering converting btrfs_qgroup_extent_record::node to XArray, inspired by the recent conversion by Filipe for btrfs_root::inodes.

Which should reduce the memory usage for btrfs_qgroup_extent_record.

Thanks for your suggestion. I saw the patch, it's really great. Maybe I can try to do same thing for btrfs_qgroup_extent_record::node.

Quoted 11 lines
Quoted 5 lines

Also, is it a meaningful to view the contents of snapshots without rolling them back? The company I work for is considering implementing it recently...

What do you mean by rolling back?

Quoted 2 lines

IIRC one can always access the snapshot from parent subvolume, or just mount the snapshot.

yeh, I realized it now.

Quoted 24 lines

Thanks,
Qu

Quoted 20 lines
Quoted 19 lines

Thanks,
Qu

Quoted 16 lines
---
   fs/btrfs/qgroup.h | 1 -
   1 file changed, 1 deletion(-)
fs/btrfs/qgroup.h +0 -1
index 706640be0ec2..7874c972029c 100644
@@ -123,7 +123,6 @@ struct btrfs_inode;
 
   /*
    * Record a dirty extent, and info qgroup to update quota on it
- * TODO: Use kmem cache to alloc it.
    */
   struct btrfs_qgroup_extent_record {
       struct rb_node node;