-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for user/group dnode accounting & quota #3983
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ struct dmu_tx; | |
(arc_buf_size(buf) > OBJSET_OLD_PHYS_SIZE) | ||
|
||
#define OBJSET_FLAG_USERACCOUNTING_COMPLETE (1ULL<<0) | ||
#define OBJSET_FLAG_USEROBJACCOUNTING_COMPLETE (1ULL<<1) | ||
|
||
typedef struct objset_phys { | ||
dnode_phys_t os_meta_dnode; | ||
|
@@ -68,6 +69,8 @@ typedef struct objset_phys { | |
dnode_phys_t os_groupused_dnode; | ||
} objset_phys_t; | ||
|
||
typedef int (*dmu_objset_upgrade_cb_t)(objset_t *); | ||
|
||
struct objset { | ||
/* Immutable: */ | ||
struct dsl_dataset *os_dsl_dataset; | ||
|
@@ -125,6 +128,13 @@ struct objset { | |
kmutex_t os_user_ptr_lock; | ||
void *os_user_ptr; | ||
sa_os_t *os_sa; | ||
|
||
/* kernel thread to upgrade this dataset */ | ||
kmutex_t os_upgrade_lock; | ||
taskqid_t os_upgrade_id; | ||
dmu_objset_upgrade_cb_t os_upgrade_cb; | ||
boolean_t os_upgrade_exit; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about placing this generic upgrade code in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For 1000 active dataset - is it imaginary or real case - if this is the real case we need to solve it absolutely. Actually I was going to make a proposal to start upgrade thread in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a real case, we definitely have users with 1000+ datasets which all get mounted. I'm aware of one user with 10,000+. Starting them in
What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm.. I don't want to bind the upgrading thread or taskq to pool. This is supposed to be a system level tunables. I would rather have a module parameter to control the parallelism of upgrading, and then in This seems much easier - do you see any problems from this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's certainly an option, although I don't think it's unreasonable to tie it to the spa. My reasoning is that the major limiting factor should be the performance of the disk, not some shared system resource like cpu or memory. Assuming that's true then I'd think we'd want to scale the number of upgrade threads with the number of pools. We could still have a module option to control the number of threads in the taskq. Since the vast majority of systems only have a single pool for many installations this would be effectively a system tunable. I don't see any problems doing it the way you suggest, but I'm not sure it's simpler. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to admit that |
||
int os_upgrade_status; | ||
}; | ||
|
||
#define DMU_META_OBJSET 0 | ||
|
@@ -173,6 +183,17 @@ void dmu_objset_userquota_get_ids(dnode_t *dn, boolean_t before, dmu_tx_t *tx); | |
boolean_t dmu_objset_userused_enabled(objset_t *os); | ||
int dmu_objset_userspace_upgrade(objset_t *os); | ||
boolean_t dmu_objset_userspace_present(objset_t *os); | ||
boolean_t dmu_objset_userobjused_enabled(objset_t *os); | ||
void dmu_objset_userobjspace_upgrade(objset_t *os); | ||
boolean_t dmu_objset_userobjspace_present(objset_t *os); | ||
|
||
static inline boolean_t dmu_objset_userobjspace_upgradable(objset_t *os) | ||
{ | ||
return (dmu_objset_type(os) == DMU_OST_ZFS && | ||
dmu_objset_userobjused_enabled(os) && | ||
!dmu_objset_userobjspace_present(os)); | ||
} | ||
|
||
int dmu_fsname(const char *snapname, char *buf); | ||
|
||
void dmu_objset_evict_done(objset_t *os); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,11 +126,14 @@ enum dnode_dirtycontext { | |
}; | ||
|
||
/* Is dn_used in bytes? if not, it's in multiples of SPA_MINBLOCKSIZE */ | ||
#define DNODE_FLAG_USED_BYTES (1<<0) | ||
#define DNODE_FLAG_USERUSED_ACCOUNTED (1<<1) | ||
#define DNODE_FLAG_USED_BYTES (1 << 0) | ||
#define DNODE_FLAG_USERUSED_ACCOUNTED (1 << 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [cstyle] whitespace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never mind, Chrome just rendered this badly. |
||
|
||
/* Does dnode have a SA spill blkptr in bonus? */ | ||
#define DNODE_FLAG_SPILL_BLKPTR (1<<2) | ||
#define DNODE_FLAG_SPILL_BLKPTR (1 << 2) | ||
|
||
/* User/Group dnode accounting */ | ||
#define DNODE_FLAG_USEROBJUSED_ACCOUNTED (1 << 3) | ||
|
||
typedef struct dnode_phys { | ||
uint8_t dn_type; /* dmu_object_type_t */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new delegations need to be added to the
tests/zfs-tests/tests/functional/delegate/*
tests for verification. Currently these tests are disabled but the work in #4487 is close to complete and it will enable this functionality.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will figure this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the delegation tests are now enabled in master.