-
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
mds/client: support discard #189
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 |
---|---|---|
|
@@ -152,13 +152,33 @@ int CurveRequestExecutor::GetInfo( | |
return 0; | ||
} | ||
|
||
int CurveRequestExecutor::Discard( | ||
NebdFileInstance* fd, NebdServerAioContext* aioctx) { | ||
int CurveRequestExecutor::Discard(NebdFileInstance* fd, | ||
NebdServerAioContext* aioctx) { | ||
int curveFd = GetCurveFdFromNebdFileInstance(fd); | ||
if (curveFd < 0) { | ||
LOG(ERROR) << "Parse curve fd failed"; | ||
return -1; | ||
} | ||
|
||
aioctx->ret = 0; | ||
aioctx->cb(aioctx); | ||
CurveAioCombineContext* curveCombineCtx = new CurveAioCombineContext(); | ||
curveCombineCtx->nebdCtx = aioctx; | ||
int ret = FromNebdCtxToCurveCtx(aioctx, &curveCombineCtx->curveCtx); | ||
if (ret < 0) { | ||
LOG(ERROR) << "Convert nebd aio context to curve aio context failed, " | ||
"curve fd: " | ||
<< curveFd; | ||
delete curveCombineCtx; | ||
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. 打印error日志 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. fix |
||
return -1; | ||
} | ||
|
||
return 0; | ||
ret = client_->AioDiscard(curveFd, &curveCombineCtx->curveCtx); | ||
if (ret == LIBCURVE_ERROR::OK) { | ||
return 0; | ||
} | ||
|
||
LOG(ERROR) << "Curve client return failed, curve fd: " << curveFd; | ||
delete curveCombineCtx; | ||
return -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. 打印error日志 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. fix |
||
} | ||
|
||
int CurveRequestExecutor::AioRead( | ||
|
@@ -271,7 +291,9 @@ int CurveRequestExecutor::FromNebdOpToCurveOp(LIBAIO_OP op, LIBCURVE_OP *out) { | |
case LIBAIO_OP::LIBAIO_OP_WRITE: | ||
*out = LIBCURVE_OP_WRITE; | ||
return 0; | ||
|
||
case LIBAIO_OP::LIBAIO_OP_DISCARD: | ||
*out = LIBCURVE_OP_DISCARD; | ||
return 0; | ||
default: | ||
return -1; | ||
} | ||
|
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.
打下error日志
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.
fix