-
Notifications
You must be signed in to change notification settings - Fork 526
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
curvefs: xattr summary info support hard link #1185
Conversation
@@ -227,6 +227,9 @@ CURVEFS_ERROR InodeWrapper::LinkLocked() { | |||
inode_.set_ctime_ns(now.tv_nsec); | |||
inode_.set_mtime(now.tv_sec); | |||
inode_.set_mtime_ns(now.tv_nsec); | |||
if (inode_.type() != FsFileType::TYPE_DIRECTORY && parent != 0) { |
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.
why do not record parent for FsFileType::TYPE_DIRECTORY ?
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.
why do not record parent for FsFileType::TYPE_DIRECTORY ?
To maintain unity and the parent maybe used later. Here only link and unlink need deal with spectially.
param.mode = request->mode(); | ||
param.type = request->type(); | ||
param.parent = request->parent(); | ||
param.rdev = request->rdev(); |
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.
init param.symlink
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.
init param.symlink
Inited in line468
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.
if param.type != FsFileType::TYPE_SYM_LINK
not inited
fixed
param.mode = request->mode(); | ||
param.length = 0; | ||
param.type = FsFileType::TYPE_DIRECTORY; | ||
param.rdev = 0; |
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.
param.parent not inited, it may any num in release mode
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.
param.parent not inited, it may any num in release mode
fixed.
} | ||
} | ||
} | ||
|
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.
why UnLinkLocked handle parent , but DecreaseNLink does not handle parent?
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.
why UnLinkLocked handle parent , but DecreaseNLink does not handle parent?
The operation 'UnLinkLocked' is used for current Inode if nlink is decreased to 0 will be deleted. But 'DecreaseNLink' is only used to decrease parentInode nlink have no inode delete.
@@ -271,10 +283,29 @@ void RenameOperator::UnlinkOldInode() { | |||
return; | |||
} | |||
|
|||
auto rc = UnLinkInode(oldInodeId_); | |||
auto rc = UnLinkInode(oldInodeId_, newParentId_); |
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.
why some unlinkinode only have one param, some have two params
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.
why some unlinkinode only have one param, some have two params
The UnLinkInode with one param(actual two params, with one default param) used in 'UnlinkSrcParentInode' only decrease nlink of srcParentInode and will not occured delete.
The UnLinkInode with two params used to decrease nlink of current inode maybe be deleted when nlink decreased to 0.
param.mode = request->mode(); | ||
param.type = request->type(); | ||
param.parent = request->parent(); | ||
param.rdev = request->rdev(); |
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.
if param.type != FsFileType::TYPE_SYM_LINK
not inited
fixed
if (trc == CURVEFS_ERROR::OK) { | ||
std::shared_ptr<InodeWrapper> inodeWrapper; | ||
trc = inodeManager_->GetInode(oldInodeId_, inodeWrapper); | ||
if (trc == CURVEFS_ERROR::OK) { |
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.
split it into anther Operator will be better
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.
agree! maybe add an operator after Precheck
is better, like:
CURVEFS_ERROR RenameOperator::Check4Something() {
if (oldInodeId_ == 0) {
return CURVEFS_ERROR::OK;
}
// do something like record `oldInodeSize_` and `oldInodeType_`
}
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.
fixed.
@@ -248,6 +236,8 @@ MetaStatusCode InodeManager::UpdateInode(const UpdateInodeRequest &request) { | |||
UPDATE_INODE(gid) | |||
UPDATE_INODE(mode) | |||
|
|||
*(old->mutable_parent()) = request.parent(); |
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.
if (request.has_parent())?
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.
The parent is a 'repeated' type has no 'has_*' and the parent field is Inherent property of inode like uid,gid,mode. So here can check parent_size(), but feel unnecessary.
curvefs/src/client/client_operator.h
Outdated
void UpdateCache(); | ||
|
||
void GetOldInode(uint64_t *oldInodeId, int64_t *oldInodeSize, | ||
FsFileType *oldInodeType) { |
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.
indentation
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.
fixed
std::to_string(inodeWrapper->GetLength())}); | ||
// return ok even update xattr failed | ||
CURVEFS_ERROR trc = CURVEFS_ERROR::OK; | ||
if (enableSumInDir_) { |
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.
maybe move the below logic into one funciton is beeter, it's too much.
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.
fixed
fd788fd
to
44c4e60
Compare
recheck |
What problem does this PR solve?
Issue Number: close #xxx
Problem Summary:
What is changed and how it works?
What's Changed:
How it Works:
Side effects(Breaking backward compatibility? Performance regression?):
Check List