forked from caoXF/curve
Compare commits
22 Commits
master
...
cto_perf_p
| Author | SHA1 | Date |
|---|---|---|
|
|
31ee171451 | |
|
|
beb73cdb13 | |
|
|
021184edf1 | |
|
|
b0b7562924 | |
|
|
75da83e9ee | |
|
|
25e0669e7b | |
|
|
f519240152 | |
|
|
90f11d2182 | |
|
|
1576a86910 | |
|
|
afa980bb2b | |
|
|
705458928b | |
|
|
c1a66b902b | |
|
|
1420440d85 | |
|
|
c1c9962fcb | |
|
|
b96f56bde1 | |
|
|
90f64fe044 | |
|
|
260e4630be | |
|
|
503aa3483b | |
|
|
549c0fa75f | |
|
|
378684ca97 | |
|
|
aa957d3c2e | |
|
|
bd2c5b3438 |
7
.bazelrc
7
.bazelrc
|
|
@ -1,10 +1,5 @@
|
|||
build --verbose_failures
|
||||
|
||||
build --define=with_glog=true --define=libunwind=true
|
||||
build --copt -DHAVE_ZLIB=1 --copt -DGFLAGS_NS=google --copt -DUSE_BTHREAD_MUTEX
|
||||
build --cxxopt -Wno-error=format-security
|
||||
build:gcc7-later --cxxopt -faligned-new
|
||||
build --incompatible_blacklisted_protos_requires_proto_info=false
|
||||
build --copt=-fdiagnostics-color=always
|
||||
|
||||
run --copt=-fdiagnostics-color=always
|
||||
build --incompatible_blacklisted_protos_requires_proto_info=false
|
||||
147
.clang-format
147
.clang-format
|
|
@ -1,147 +0,0 @@
|
|||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -3
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: true
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveBitFields: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentCaseLabels: false
|
||||
IndentCaseBlocks: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: None
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 2
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
- PP_STRINGIZE
|
||||
- BOOST_PP_STRINGIZE
|
||||
...
|
||||
12
.clangd
12
.clangd
|
|
@ -1,12 +0,0 @@
|
|||
Diagnostics:
|
||||
ClangTidy:
|
||||
Add: [performance-*, modernize-*, readability-*,bugprone-*,]
|
||||
Remove: [modernize-use-trailing-return-type]
|
||||
CheckOptions:
|
||||
readability-identifier-naming.VariableCase: camelBack
|
||||
UnusedIncludes: Strict
|
||||
|
||||
InlayHints:
|
||||
Enabled: No
|
||||
ParameterNames: No
|
||||
DeducedTypes: No
|
||||
|
|
@ -78,7 +78,6 @@ runlog/
|
|||
.gdb_history
|
||||
|
||||
.clang-format
|
||||
.clangd
|
||||
!curve-snapshotcloneserver-nginx/app/lib
|
||||
!nebd/nebd-package/usr/bin
|
||||
|
||||
|
|
@ -91,7 +90,6 @@ test/client/configs/*
|
|||
projects/*
|
||||
docker/curvebs
|
||||
docker/base/*
|
||||
docker/debian*/*so*
|
||||
!docker/base/Dockerfile
|
||||
!docker/base/Makefile
|
||||
|
||||
|
|
@ -109,7 +107,6 @@ curvefs/monitor/prometheus/target.json
|
|||
curvefs/docker/*/curvefs
|
||||
curvefs/docker/curvefs
|
||||
curvefs/docker/base/*
|
||||
curvefs/docker/debian*/*so*
|
||||
!curvefs/docker/base/Dockerfile
|
||||
!curvefs/docker/base/Makefile
|
||||
curvefs/BUILD_MODE
|
||||
|
|
@ -148,21 +145,11 @@ tools-v2/*/*.test
|
|||
tools-v2/__debug_bin
|
||||
tools-v2/vendor/
|
||||
|
||||
.test
|
||||
.note
|
||||
.playground
|
||||
.dumpfile
|
||||
metastore_test.dat
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
core.*
|
||||
|
||||
test/integration/*.conf
|
||||
test/integration/client/config/client.conf*
|
||||
test/integration/snapshotcloneserver/config/*.conf
|
||||
|
||||
.pre-commit-config.yaml
|
||||
|
||||
*.deb
|
||||
*.whl
|
||||
curvefs/docker/debian9/libhashkit.so.2
|
||||
curvefs/docker/debian9/libmemcached.so.11
|
||||
curvefs/docker/debian9/libssl.so.3
|
||||
2
.obm.cfg
2
.obm.cfg
|
|
@ -1,2 +0,0 @@
|
|||
container_name: curve-build-playground-master
|
||||
container_image: opencurvedocker/curve-base:build-debian9
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
# CHANGELOG of v2.5
|
||||
|
||||
Previous change logs can be found at [CHANGELOG-2.4](https://github.com/opencurve/curve/blob/master/CHANGELOG-2.4.md)
|
||||
|
||||
|
||||
|
||||
## New Features
|
||||
|
||||
- Memcache support
|
||||
- [curvefs/client: support memcached cluster](https://github.com/opencurve/curve/pull/2096) @ilixiaocui
|
||||
- [curvefs/mds: support memcache cluster](https://github.com/opencurve/curve/pull/2108) @Cyber-SiKu
|
||||
- [curvefs/client: add global cache client like memcached](https://github.com/opencurve/curve/pull/2102) @fansehep
|
||||
- [curvefs/client: fix client core dump error](https://github.com/opencurve/curve/pull/2157) @ilixiaocui
|
||||
- [add ut](https://github.com/opencurve/curve/pull/2164) @Cyber-SiKu
|
||||
|
||||
- curvefs new tools
|
||||
- [add delete impl](https://github.com/opencurve/curve/pull/2088) @shentupenghui
|
||||
- [feat: [tools-v2] bs list dir](https://github.com/opencurve/curve/pull/2082) @Sindweller
|
||||
- [fix missing docs links](https://github.com/opencurve/curve/pull/2082) @zyb521
|
||||
- [curve/toos-v2: add list client #2037](https://github.com/opencurve/curve/pull/2076) @tsonglew
|
||||
- [support create volume directory by curve_ops_tool](https://github.com/opencurve/curve/pull/2078) @aspirer
|
||||
|
||||
- [install: added playground.](https://github.com/opencurve/curve/pull/2053) @Wine93
|
||||
|
||||
## Optimization
|
||||
|
||||
- [update the braft to vesion v1.1.2](https://github.com/opencurve/curve/pull/2091) @tangwz
|
||||
|
||||
- [curvefs/client: local cache policy optimization](https://github.com/opencurve/curve/pull/2064) @Tangruilin
|
||||
|
||||
|
||||
- [sync by threadpool](https://github.com/opencurve/curve/pull/1912) @fansehep
|
||||
|
||||
- Merge block storage and file storage compilation scripts
|
||||
- [Merge block storage and file storage compilation scripts
|
||||
](https://github.com/opencurve/curve/pull/2089) @linshiyx
|
||||
- [Add help_msg in Makefile](https://github.com/opencurve/curve/pull/2133) @linshiyx
|
||||
- [fix image.sh](https://github.com/opencurve/curve/pull/2124) @SeanHai
|
||||
|
||||
- [fix bs list zone typo](https://github.com/opencurve/curve/pull/2066) @tsonglew
|
||||
|
||||
- [spell optimize](https://github.com/opencurve/curve/pull/2059) @shentupenghui
|
||||
|
||||
|
||||
## Bug Fix
|
||||
|
||||
- aws s3 sdk revert
|
||||
- [revert new s3 sdk due to critical bug](https://github.com/opencurve/curve/pull/2149) @h0hmj
|
||||
- [curvefs/client: change the default value of s3](https://github.com/opencurve/curve/pull/2158) @wuhongsong
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[中文版](developers_guide_cn.md)
|
||||
[中文版](Community_Guidelines_cn.md)
|
||||
|
||||
|
||||
## Overview
|
||||
|
|
@ -18,15 +18,15 @@ The premise of participating in an open source project is to understand it, espe
|
|||
|
||||
Through the study of the above materials, I believe that you already have an overall understanding of the Curve project, and there may also be some curiosity and doubts. At this time, you can deploy a Curve experience environment, which is conducive to a more intuitive perception of the Curve system. If you encounter a problem or want a new feature, you can track the relevant code. In the process, it is easy to understand the relevant modules. This is lots of contributors completed their first contributions.
|
||||
|
||||
The Curve community has multiple [communication channels](#Communication), and there will be an online community meeting every two weeks. The regular meeting will synchronize the recent progress of the Curve project and answer your questions. You are also welcome to participate in the Curve community regular meeting. We will communicate at the meeting, so that we can quickly answer your questions, improve our understanding of the Curve project and synchronize what we are doing at this stage.
|
||||
The Curve community has multiple [communication channels](#Comminication), and there will be an online community meeting every two weeks. The regular meeting will synchronize the recent progress of the Curve project and answer your questions. You are also welcome to participate in the Curve community regular meeting. We will communicate at the meeting, so that we can quickly answer your questions, improve our understanding of the Curve project and synchronize what we are doing at this stage.
|
||||
|
||||
## How to participate in Curve
|
||||
|
||||
After you have a certain understanding of the Curve project, if you are interested, you can choose the starting point to participate in the Curve. You can choose from the following aspects:
|
||||
|
||||
- Start by selecting a interested one from the [issues](https://github.com/opencurve/curve/issues) of the Curve project. You can pay attention to issues with the [good first issue](https://github.com/opencurve/curve/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22) tag which we have assessed as relatively good starters.
|
||||
- Start by selecting a interested one from the [Issues](https://github.com/opencurve/curve/issues) of the Curve project. You can pay attention to issues with the good_first_issue tag which we have assessed as relatively good starters.
|
||||
- Based on a certain understanding of the Curve project, you can also choose from [Roadmap](https://github.com/opencurve/curve/wiki/Roadmap).
|
||||
- Selecting form [issues](https://github.com/opencurve/curveadm/issues) and [Roadmap](https://github.com/opencurve/curveadm/issues/92) of Curve Operation and maintenance tools [Curveadm](https://github.com/opencurve/curveadm). Here are [quick start guidelines](https://github.com/opencurve/curveadm/wiki/develop)。
|
||||
- Selecting form [Issues](https://github.com/opencurve/curveadm/issues) and [Roadmap](https://github.com/opencurve/curveadm/issues/92) of Curve Operation and maintenance tools [Curveadm](https://github.com/opencurve/curveadm). Here are [quick start guidelines](https://github.com/opencurve/curveadm/wiki/develop)。
|
||||
- In addition to the existing issues, you are also welcome to submit issues that you have discovered or new features you hope for and resolve them.
|
||||
- You can pay attention to the *TODO* in the existing Curve code, most of which are code logic optimization and features to be supplemented, choose the ones you are interested in and raise relevant issues to follow up and try to solve.
|
||||
|
||||
|
|
@ -87,12 +87,6 @@ If the work to be done is more complicated, you need to write a detailed design
|
|||
It is also recommended to communicate with us before starting the plan writing. If you are not sure about the feasibility of the plan, you can provide a simple plan description first, and then refine and develop it after our evaluation.
|
||||
|
||||
|
||||
## How to start a document contribution
|
||||
|
||||
The curve docs path is in [curve/docs/](https://github.com/opencurve/curve/tree/master/docs), please use markdown format about the docs contribution except ppt.
|
||||
|
||||
Document contribution don't need to trigger CI. please add ```[skipci]``` in your github pr title.
|
||||
|
||||
## How to submit a PR
|
||||
|
||||
Once you've finished writing the code, you can submit a PR. Of course, if the development has not been completed, you can submit PR first in some cases. For example, if you want to let the community take a look at the general solution, you can raise the price of PR after completing the code framework.
|
||||
|
|
@ -101,46 +95,15 @@ Once you've finished writing the code, you can submit a PR. Of course, if the de
|
|||
|
||||
[Build and run Curve tests](https://github.com/opencurve/curve/blob/master/docs/en/build_and_run_en.md#test-case-compilation-and-execution)
|
||||
|
||||
Please use clangd for your code completions. More details is in [curve_clangd.md](https://github.com/opencurve/curve/blob/master/docs/cn/clangd.md).
|
||||
|
||||
Curve Ci use ```cpplint``` check what your changed.
|
||||
|
||||
- install ``cpplint``` (need root)
|
||||
```bash
|
||||
$ pip install cpplint
|
||||
```
|
||||
|
||||
- check your changed local
|
||||
```bash
|
||||
$ cpplint --filter=-build/c++11 --quiet --recursive your_path
|
||||
```
|
||||
|
||||
For PR we have the following requirements:
|
||||
|
||||
- The Curve coding standard strictly follows the [Google C++ Open Source Project Coding Guide](https://google.github.io/styleguide/cppguide.html), but we use 4 spaces to indent, Clang-format will more helpful for you. Of course, CI will check what your changed.
|
||||
- The CURVE coding standard strictly follows the [Google C++ Open Source Project Coding Guide](https://google.github.io/styleguide/cppguide.html), please follow this guide as well Submit your code.
|
||||
- The code must have test cases, excluding documentation, unit tests (incremental lines cover more than 80%, and incremental branches cover more than 70%); integration tests (merge statistics with unit tests, and meet the unit test coverage requirements).
|
||||
- Please fill in the description of the PR as detailed as possible, associate with the relevant issues, and the PR commit message can clearly see the resolved issues. After submitting to the Curve master branch, Curve CI will be triggered automatically. It is necessary to ensure that the CI is passed, and the Jenkins username and password of the CI is netease/netease, if the CI fails to run, you can log in to the Jenkins platform to view the reason for the failure.
|
||||
- After the CI is passed, the review can start, and each PR needs to get at least two LGTMs of Committer/Maintainer before merging.
|
||||
- PR code requires a certain amount of comments to make the code easy to understand, and all comments and review comments and replies are required to be in English.
|
||||
|
||||
- Please make sure your changed can pass the compile locally.
|
||||
|
||||
- We usually merge only one commit after you rebase.
|
||||
|
||||
- Trigger CI please comment ```cicheck```.
|
||||
|
||||
CI checkpoints:
|
||||
|
||||
1. The changed code style check(cpplint).
|
||||
2. Branch test coverage testing.
|
||||
3. Unit tests(If failed, run the failed tests locally).
|
||||
4. Chaos tests.
|
||||
|
||||
Repush will trigger CI, If github page have no reaction. Please wait.
|
||||
|
||||
If CI is not stabled, repeatedly comment ```cicheck``` will trigger CI again.
|
||||
|
||||
## Communication
|
||||
## Comminication
|
||||
|
||||
At present, the Curve community has multiple communication channels, please choose an appropriate and efficient communication method according to your needs:
|
||||
|
||||
|
|
@ -151,4 +114,4 @@ At present, the Curve community has multiple communication channels, please choo
|
|||
- **slack**: cloud-native.slack.com,channel #project_curve
|
||||
- **Curve User Group**: In order to facilitate instant communication with everyone, the Curve User Group is currently a WeChat group. Due to the large number of people in the group, it is necessary to add OpenCurve_bot WeChat first, and then invite into the group. In the user group, everyone can freely communicate about Curve and storage-related topics, and get immediate feedback on problems.
|
||||
|
||||
<img src="docs/images/curve-wechat.jpeg" style="zoom: 75%;" />
|
||||
<img src="docs/images/curve-wechat.jpeg" style="zoom: 75%;" />
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[English version](developers_guide.md)
|
||||
[English version](Community_Guidelines.md)
|
||||
|
||||
|
||||
## 概述
|
||||
|
|
@ -24,9 +24,9 @@ Curve 社区有多个[沟通渠道](#社区交流),每两周还会有线上的
|
|||
|
||||
在对 Curve 项目有一定了解后,如果感兴趣就可以选择入手点进行 Curve 开源项目的参与了,可以从以下几个方面进行选择:
|
||||
|
||||
- 从 Curve 项目的 [issue](https://github.com/opencurve/curve/issues) 中选择感兴趣的问题入手,可以特别关注带有 [good first issue](https://github.com/opencurve/curve/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22) tag 的 issue,这些是我们经过评估认为是相对好入门的一些问题。
|
||||
- 从 Curve 项目的 [Issue](https://github.com/opencurve/curve/issues) 中选择感兴趣的问题入手,可以特别关注带有 good_first_issue tag 的 issue,这些是我们经过评估认为是相对好入门的一些问题。
|
||||
- 在对 Curve 项目有一定了解的基础上也可以从 [Roadmap](https://github.com/opencurve/curve/wiki/Roadmap_CN) 中进行选择。
|
||||
- 从 Curve 项目的运维工具 [Curveadm](https://github.com/opencurve/curveadm) 的 [issue](https://github.com/opencurve/curveadm/issues) 和 [Roadmap](https://github.com/opencurve/curveadm/issues/92) 中进行选择,开发方式可参见 [快速上手 CurveAdm 开发](https://github.com/opencurve/curveadm/wiki/develop)。
|
||||
- 从 Curve 项目的运维工具 [Curveadm](https://github.com/opencurve/curveadm) 的 [Issue](https://github.com/opencurve/curveadm/issues) 和 [Roadmap](https://github.com/opencurve/curveadm/issues/92) 中进行选择,开发方式可参见[快速上手 CurveAdm 开发](https://github.com/opencurve/curveadm/wiki/develop)。
|
||||
- 除了已有的 issue,也欢迎将自己发现的问题或希望的新特性提出 issue 并进行解决。
|
||||
- 可以关注现有 Curve 代码中的 *TODO* ,大部分为代码逻辑优化和待补充特性,选择感兴趣的提出相关 issue 跟进并尝试解决。
|
||||
|
||||
|
|
@ -45,11 +45,6 @@ Curve 社区有多个[沟通渠道](#社区交流),每两周还会有线上的
|
|||
|
||||
在开始方案撰写之前同样建议先与我们进行沟通,对方案的可行性不太确定的可以先提供简单的方案描述,经过我们评估后再进行细化和开发。
|
||||
|
||||
## 如何进行文档贡献
|
||||
|
||||
Curve 的文档位于 [curve/docs/](https://github.com/opencurve/curve/tree/master/docs), 贡献请使用 markdown 格式(除了ppt).
|
||||
|
||||
文档贡献无需触发 CI, 请在 github pull request 标题头部加上 ```[skipci]```.
|
||||
|
||||
## 如何提交PR
|
||||
|
||||
|
|
@ -59,23 +54,11 @@ Curve 的文档位于 [curve/docs/](https://github.com/opencurve/curve/tree/mast
|
|||
|
||||
[Curve 测试用例编译及执行](https://github.com/opencurve/curve/blob/master/docs/cn/build_and_run.md#测试用例编译及执行)
|
||||
|
||||
代码补全: 请使用 clangd 作为代码补全, 请见 [curve_clangd.md](https://github.com/opencurve/curve/blob/master/docs/cn/clangd.md).
|
||||
|
||||
Curve CI 使用```cpplint```检查更改的代码,
|
||||
- 安装```cpplint``` (需要root):
|
||||
```bash
|
||||
$ pip install cpplint
|
||||
```
|
||||
- 本地进行代码检查:
|
||||
```bash
|
||||
$ cpplint --filter=-build/c++11 --quiet --recursive your_path
|
||||
```
|
||||
|
||||
对于 PR 我们有如下要求:
|
||||
|
||||
- Curve编码规范严格按照[Google C++开源项目编码指南](https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/contents/)来进行代码编写,但使用 4 空格进行缩进, 可使用 clang-format 进行格式化, CI 会检查相关更改代码是否符合规则.
|
||||
- CURVE编码规范严格按照[Google C++开源项目编码指南](https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/contents/)来进行代码编写,请您也遵循这一指南来提交您的代码。
|
||||
- 代码必须有测试,文档除外,单元测试(增量行覆盖80%以上,增量分支覆盖70%以上);集成测试(与单元测试合并统计,满足单元测试覆盖率要求即可)
|
||||
- 请尽可能详细的填写 PR 的描述,关联相关问题的 issue,PR commit message 能清晰看出解决的问题,提交到 Curve master 分支之后会自动触发Curve CI,需保证 CI 通过,CI 的 Jenkins 用户名密码为 netease/netease,如遇到 CI 运行失败可以登录 Jenkins 平台查看失败原因。
|
||||
- 请尽可能详细的填写 PR 的描述,关联相关问题的 issuse,PR commit message 能清晰看出解决的问题,提交到 Curve master 分支之后会自动触发Curve CI,需保证 CI 通过,CI 的 Jenkins 用户名密码为 netease/netease,如遇到 CI 运行失败可以登录 Jenkins 平台查看失败原因。
|
||||
- CI 通过之后可开始进行 review,每个 PR 在合并之前都需要至少得到两个 Committer/Maintainer 的 LGTM。
|
||||
- PR 代码需要一定量的注释来使代码容易理解,且所有注释和 review 意见和回复均要求使用英语。
|
||||
|
||||
|
|
@ -119,25 +102,6 @@ type 可以是以下类型之一:
|
|||
|
||||
footer 是可选的,用来记录对应因为这些更改而可以关闭的 issue,如 `Close #12345`
|
||||
|
||||
提交 PR 之前, 请确保你的更改可以成功在本地编译.
|
||||
|
||||
与大多数项目一样, review 通过之后请将你诸多commits rebase 成为一个 commit.
|
||||
|
||||
触发 CI 请 comment ```cicheck```.
|
||||
|
||||
若发现测试错误, 可查看 CI 对应错误测试.
|
||||
|
||||
CI 检查点有:
|
||||
|
||||
1. 更改代码风格检查(cpplint)
|
||||
2. 分支覆盖率检查(可能会失败)
|
||||
3. 单元测试 (若失败请先尝试在本地运行对应失败测试)
|
||||
4. 混沌测试
|
||||
|
||||
重新 push 会触发 CI, 若暂时无反应, 请耐心等待, 测试处于排队中.
|
||||
|
||||
若 CI 不稳定, 可重复 comment ```cicheck``` 以重新触发 CI.
|
||||
|
||||
## 社区交流
|
||||
|
||||
目前 Curve 社区有多个沟通交流的渠道,请根据自己的需求选择合适高效的沟通方式:
|
||||
|
|
@ -149,4 +113,4 @@ CI 检查点有:
|
|||
- **slack**: cloud-native.slack.com,channel #project_curve
|
||||
- **Curve User Group**: 为了便于大家即时的沟通,Curve User Group 目前为微信群,由于群人数过多,需要先添加OpenCurve_bot微信,再邀请进群。在用户群里大家可以自由的沟通关于 Curve 和存储相关的话题,对于存在问题也可以较为即时的得到反馈。
|
||||
|
||||
<img src="docs/images/curve-wechat.jpeg" style="zoom: 75%;" />
|
||||
<img src="docs/images/curve-wechat.jpeg" style="zoom: 75%;" />
|
||||
8
Makefile
8
Makefile
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc.
|
||||
|
||||
.PHONY: list build dep install image playground check test
|
||||
.PHONY: list build dep install image
|
||||
|
||||
stor?=""
|
||||
prefix?= "$(PWD)/projects"
|
||||
|
|
@ -73,9 +73,3 @@ image:
|
|||
|
||||
playground:
|
||||
@bash util/playground.sh
|
||||
|
||||
check:
|
||||
@bash util/check.sh $(stor)
|
||||
|
||||
test:
|
||||
@bash util/test.sh $(stor) $(only)
|
||||
|
|
|
|||
41
README.md
41
README.md
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
<div align=center> <image src="docs/images/cncf-icon-color.png" width = 8%>
|
||||
|
||||
**A cloud-native distributed storage system**
|
||||
|
||||
**A sandbox project hosted by the CNCF Foundation**
|
||||
**A could-native distributed storage system**
|
||||
|
||||
#### English | [简体中文](README_cn.md)
|
||||
### 📄 [Documents](https://github.com/opencurve/curve/tree/master/docs) || 🌐 [Official Website](https://www.opencurve.io/Curve/HOME) || 🏠 [Forum](https://ask.opencurve.io/t/topic/7)
|
||||
|
|
@ -44,24 +42,11 @@
|
|||
- [LICENSE](#license)
|
||||
- [Release Cycle](#release-cycle)
|
||||
- [Branch](#branch)
|
||||
- [Contributors](#contributors)
|
||||
- [Star History](#star-history)
|
||||
- [Feedback & Contact](#feedback--contact)
|
||||
|
||||
## About Curve
|
||||
|
||||
**Curve** is a modern storage system developed by netease, currently supporting file storage(CurveFS) and block storage(CurveBS). Now it's hosted at [CNCF](https://www.cncf.io/) as a sandbox project.
|
||||
|
||||
The core application scenarios of CurveBS mainly include:
|
||||
- the performance, mixed, capacity cloud disk or persistent volume of virtual machine/container, and remote disks of physical machines
|
||||
- high-performance separation of storage and computation architecture: high-performance and low latency architecture based on RDMA+SPDK, supporting the separation deployment structure of various databases such as MySQL and Kafka
|
||||
|
||||
|
||||
The core application scenarios of CurveFS mainly include:
|
||||
- the cost-effective storage in AI training scene
|
||||
- the hot and cold data automation layered storage in big data scenarios
|
||||
- the cost-effective shared file storage on the public cloud: It can be used for business scenarios such as AI, big data, file sharing
|
||||
- Hybrid storage: Hot data is stored in the local IDC, cold data is stored in public cloud
|
||||
**Curve** is a mordern storage system developed by netease, currently supporting file storage(CurveFS) and block storage(CurveBS). Now it's hosted at [CNCF](https://www.cncf.io/) as a sandbox project.
|
||||
|
||||
<details>
|
||||
<summary><b><font=5>High Performance | More stable | Easy Operation | Cloud Native</b></font></summary>
|
||||
|
|
@ -126,7 +111,7 @@ The core application scenarios of CurveFS mainly include:
|
|||
|
||||
</details>
|
||||
<details>
|
||||
<summary><b><font=5>Docking Kubernetes</b></font></summary>
|
||||
<summary><b><font=5>Docking Kubernates</b></font></summary>
|
||||
|
||||
- Use [Curve CSI Driver](https://github.com/opencurve/curve-csi), The plugin implements the Container Storage Interface(CSI) between Container Orchestrator(CO) and Curve cluster. It allows dynamically provisioning curve volumes and attaching them to workloads.
|
||||
- For details of the documentation, see [CSI Curve Driver Doc](https://github.com/opencurve/curve-csi/blob/master/docs/README.md).
|
||||
|
|
@ -158,7 +143,7 @@ Curve supports deployment in private and public cloud environments, and can also
|
|||
<div align=center> <image src="docs/images/Curve-deploy-on-premises-idc.png" width=60%>
|
||||
<div align=left>
|
||||
|
||||
One of them, CurveFS shared file storage system, can be elastically scaled to public cloud storage, which can provide users with greater capacity elasticity, lower cost, and better performance experience.
|
||||
One of them, CurveFS shared file storage system, can be elasticly scaled to public cloud storage, which can provide users with greater capacity elasticity, lower cost, and better performance experience.
|
||||
|
||||
</details>
|
||||
|
||||
|
|
@ -214,8 +199,6 @@ Fio Curve engine is added, you can clone https://github.com/opencurve/fio and co
|
|||
$ ./fio --thread --rw=randwrite --bs=4k --ioengine=nebd --nebd=cbd:pool//pfstest_test_ --iodepth=10 --runtime=120 --numjobs=10 --time_based --group_reporting --name=curve-fio-test
|
||||
```
|
||||
|
||||
If you have any questions during performance testing, please check the [Curve block storage performance tuning guide](docs/cn/Curve%E5%9D%97%E5%AD%98%E5%82%A8%E6%80%A7%E8%83%BD%E8%B0%83%E4%BC%98%E6%8C%87%E5%8D%97.md).
|
||||
|
||||
## CurveFS quick start
|
||||
Please use [CurveAdm](https://github.com/opencurve/curveadm/wiki) tool to deploy CurveFS,see [CurveFS Deployment Process](https://github.com/opencurve/curveadm/wiki/curvefs-cluster-deployment), and the [CurveFS Command Instructions](curvefs/src/tools#readme).
|
||||
|
||||
|
|
@ -225,13 +208,12 @@ Please refer to the [Test environment configuration](docs/cn/测试环境配置
|
|||
|
||||
## Practical
|
||||
- [CurveBS+NFS Build NFS Server](docs/practical/curvebs_nfs.md)
|
||||
- [CurveFS+MinIO S3 Gateway](https://github.com/opencurve/curve-meetup-slides/blob/main/PrePaper/2023/%E6%94%AF%E6%8C%81POSIX%E5%92%8CS3%E7%BB%9F%E4%B8%80%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4%E2%80%94%E2%80%94Curve%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9FS3%E7%BD%91%E5%85%B3%E9%83%A8%E7%BD%B2%E5%AE%9E%E8%B7%B5.md)
|
||||
|
||||
## Governance
|
||||
See [Governance](https://github.com/opencurve/community/blob/master/GOVERNANCE.md).
|
||||
|
||||
## Contribute us
|
||||
Participation in the Curve project is described in the [Curve Developers Guidelines](developers_guide.md) and is subject to a [contributor contract](https://github.com/opencurve/curve/blob/master/CODE_OF_CONDUCT.md).
|
||||
Participation in the Curve project is described in the [Curve Open Source Community Guidelines](Community_Guidelines.md) and is subject to a [contributor contract](https://github.com/opencurve/curve/blob/master/CODE_OF_CONDUCT.md).
|
||||
We welcome your contribution!
|
||||
|
||||
## Code of Conduct
|
||||
|
|
@ -248,19 +230,6 @@ Curve is distributed under the [**Apache 2.0 LICENSE**](LICENSE).
|
|||
## Branch
|
||||
All the developments will be done under master branch. If there's any new version to establish, a new branch release-x.y will be pulled from the master, and the new version will be released from this branch.
|
||||
|
||||
## Contributors
|
||||
This project exists thanks to all the people who contribute.
|
||||
|
||||
<a href="https://github.com/opencurve/curve/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=opencurve/curve" />
|
||||
</a>
|
||||
|
||||
Made with [contrib.rocks](https://contrib.rocks).
|
||||
|
||||
## Star History
|
||||
|
||||
[](https://star-history.com/#opencurve/curve&Date)
|
||||
|
||||
## Feedback & Contact
|
||||
- [Github Issues](https://github.com/openCURVE/CURVE/issues):You are sincerely welcomed to issue any bugs you came across or any suggestions through Github issues. If you have any question you can refer to our FAQ or join our user group for more details.
|
||||
- [FAQ](https://github.com/openCURVE/CURVE/wiki/CURVE-FAQ):Frequently asked question in our user group, and we'll keep working on it.
|
||||
|
|
|
|||
23
README_cn.md
23
README_cn.md
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
<div align=center> <image src="docs/images/cncf-icon-color.png" width = 8%>
|
||||
|
||||
**云原生高性能分布式存储系统**
|
||||
|
||||
**CNCF基金会的沙箱托管项目**
|
||||
**A could-native distributed storage system**
|
||||
|
||||
#### [English](README.md) | 简体中文
|
||||
### 📄 [文档](https://github.com/opencurve/curve/tree/master/docs) || 🌐 [官网](https://www.opencurve.io/Curve/HOME) || 🏠 [论坛](https://ask.opencurve.io/t/topic/7)
|
||||
|
|
@ -50,18 +48,6 @@
|
|||
## 关于 Curve
|
||||
**Curve** 是网易主导自研的现代化存储系统, 目前支持文件存储(CurveFS)和块存储(CurveBS)。现作为沙箱项目托管于[CNCF](https://www.cncf.io/)。
|
||||
|
||||
CurveBS的核心应用场景主要包括:
|
||||
- 虚拟机/容器的性能型、混合型、容量型云盘或持久化卷,以及物理机的远程存储盘
|
||||
- 高性能存算分离架构:基于RDMA+SPDK的高性能低时延架构,支撑MySQL、kafka等各类数据库、中间件的存算分离部署架构,提升实例交付效率和资源利用率
|
||||
|
||||
|
||||
CurveFS的核心应用场景主要包括:
|
||||
- AI训练(含机器学习等)场景下的高性价比存储
|
||||
- 大数据场景下的冷热数据自动化分层存储
|
||||
- 公有云上高性价比的共享文件存储:可用于AI、大数据、文件共享等业务场景
|
||||
- 混合云存储:热数据存储在本地IDC,冷数据存储在公有云
|
||||
|
||||
|
||||
<details>
|
||||
<summary><b><font=5>高性能 | 更稳定 | 易运维 | 云原生</b></font></summary>
|
||||
|
||||
|
|
@ -126,7 +112,7 @@ CurveFS的核心应用场景主要包括:
|
|||
|
||||
</details>
|
||||
<details>
|
||||
<summary><b><font=5>对接 Kubernetes</b></font></summary>
|
||||
<summary><b><font=5>对接 Kubernates</b></font></summary>
|
||||
|
||||
- 使用 [Curve CSI Driver](https://github.com/opencurve/curve-csi) 插件在 Container Orchestrator (CO) 与 Curve 集群中实现了 Container Storage Interface(CSI)。
|
||||
- 文档详见[CSI Curve Driver Doc](https://github.com/opencurve/curve-csi/blob/master/docs/README.md)。
|
||||
|
|
@ -210,8 +196,6 @@ fio的Curve块存储引擎代码已经上传到 https://github.com/opencurve/fio
|
|||
$ ./fio --thread --rw=randwrite --bs=4k --ioengine=nebd --nebd=cbd:pool//pfstest_test_ --iodepth=10 --runtime=120 --numjobs=10 --time_based --group_reporting --name=curve-fio-test
|
||||
```
|
||||
|
||||
在性能测试过程中有任何问题,请查看[Curve块存储性能调优指南](docs/cn/Curve%E5%9D%97%E5%AD%98%E5%82%A8%E6%80%A7%E8%83%BD%E8%B0%83%E4%BC%98%E6%8C%87%E5%8D%97.md)
|
||||
|
||||
## CurveFS 快速体验
|
||||
请使用 [CurveAdm](https://github.com/opencurve/curveadm/wiki) 工具进行 CurveFS 的部署,具体流程见:[CurveFS部署流程](https://github.com/opencurve/curveadm/wiki/curvefs-cluster-deployment), 以及[CurveFS命令行工具说明](curvefs/src/tools#readme)。
|
||||
|
||||
|
|
@ -223,11 +207,10 @@ $ ./fio --thread --rw=randwrite --bs=4k --ioengine=nebd --nebd=cbd:pool//pfstest
|
|||
|
||||
## 贡献我们
|
||||
|
||||
参与 Curve 项目开发详见[Curve 开发者指南](developers_guide_cn.md)并且请遵循[贡献者准则](https://github.com/opencurve/curve/blob/master/CODE_OF_CONDUCT.md), 我们期待您的贡献!
|
||||
参与 Curve 项目开发详见[Curve 开源社区指南](Community_Guidelines_cn.md)并且请遵循[贡献者准则](https://github.com/opencurve/curve/blob/master/CODE_OF_CONDUCT.md), 我们期待您的贡献!
|
||||
|
||||
## 最佳实践
|
||||
- [CurveBS+NFS搭建NFS存储](docs/practical/curvebs_nfs.md)
|
||||
- [CurveFS+S3网关部署实践](https://github.com/opencurve/curve-meetup-slides/blob/main/PrePaper/2023/%E6%94%AF%E6%8C%81POSIX%E5%92%8CS3%E7%BB%9F%E4%B8%80%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4%E2%80%94%E2%80%94Curve%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9FS3%E7%BD%91%E5%85%B3%E9%83%A8%E7%BD%B2%E5%AE%9E%E8%B7%B5.md)
|
||||
|
||||
## 行为守则
|
||||
Curve 的行为守则遵循[CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md)。
|
||||
|
|
|
|||
11
WORKSPACE
11
WORKSPACE
|
|
@ -75,14 +75,11 @@ bind(
|
|||
)
|
||||
|
||||
#import the gtest files.
|
||||
http_archive(
|
||||
new_git_repository(
|
||||
name = "com_google_googletest",
|
||||
urls = [
|
||||
"https://curve-build.nos-eastchina1.126.net/googletest-release-1.12.1.tar.gz",
|
||||
"https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz",
|
||||
],
|
||||
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
|
||||
strip_prefix = "googletest-release-1.12.1",
|
||||
build_file = "//:thirdparties/gmock.BUILD",
|
||||
remote = "https://github.com/google/googletest",
|
||||
tag = "release-1.8.0",
|
||||
)
|
||||
|
||||
bind(
|
||||
|
|
|
|||
15
buildfs.sh
15
buildfs.sh
|
|
@ -7,22 +7,12 @@ then
|
|||
exit
|
||||
fi
|
||||
|
||||
if [ `gcc -dumpversion | awk -F'.' '{print $1}'` -le 6 ]
|
||||
then
|
||||
bazelflags=''
|
||||
else
|
||||
bazelflags='--copt -faligned-new'
|
||||
fi
|
||||
|
||||
if [ "$1" = "debug" ]
|
||||
then
|
||||
DEBUG_FLAG="--compilation_mode=dbg"
|
||||
fi
|
||||
|
||||
bazel build curvefs/... --copt -DHAVE_ZLIB=1 ${DEBUG_FLAG} -s \
|
||||
--define=with_glog=true --define=libunwind=true --copt -DGFLAGS_NS=google --copt -Wno-error=format-security --copt \
|
||||
-DUSE_BTHREAD_MUTEX --copt -DCURVEVERSION=${curve_version} --linkopt -L/usr/local/lib ${bazelflags}
|
||||
|
||||
bazel build curvefs/... --copt -DHAVE_ZLIB=1 ${DEBUG_FLAG} -s --define=with_glog=true --define=libunwind=true --copt -DGFLAGS_NS=google --copt -Wno-error=format-security --copt -DUSE_BTHREAD_MUTEX --copt -DCURVEVERSION=${curve_version} --linkopt -L/usr/local/lib
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "build curvefs failed"
|
||||
|
|
@ -44,5 +34,4 @@ then
|
|||
echo "mds_test failed"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
echo "end compile"
|
||||
fi
|
||||
|
|
@ -9,20 +9,13 @@ global.enable_external_server=true
|
|||
global.external_ip=127.0.0.1 # __CURVEADM_TEMPLATE__ ${service_external_addr} __CURVEADM_TEMPLATE__
|
||||
global.external_subnet=127.0.0.0/24
|
||||
# chunk大小,一般16MB
|
||||
# it will be overwritten from chunkfilepool.meta if `chunkfilepool.enable_get_chunk_from_pool` is true
|
||||
global.chunk_size=16777216
|
||||
# chunk 元数据页大小,一般4KB
|
||||
# it will be overwritten from chunkfilepool.meta if `chunkfilepool.enable_get_chunk_from_pool` is true
|
||||
global.meta_page_size=4096
|
||||
# chunk's block size, IO requests must align with it, supported value is |512| and |4096|
|
||||
# it should consist with `block_size` in chunkfilepool.meta_path and `mds.volume.blockSize` in MDS's configurations
|
||||
# for clone chunk and snapshot chunk, it's also the minimum granularity that each bit represents
|
||||
# if set to |512|, we need 4096 bytes bitmap for each chunk, so meta_page_size should be 8192 or larger.
|
||||
# it will be overwritten from chunkfilepool.meta if `chunkfilepool.enable_get_chunk_from_pool` is true
|
||||
global.block_size=4096
|
||||
|
||||
# clone chunk允许的最长location长度
|
||||
global.location_limit=3000
|
||||
# minimum alignment for io request
|
||||
global.min_io_alignment=512
|
||||
|
||||
#
|
||||
# MDS settings
|
||||
|
|
@ -115,7 +108,7 @@ copyset.scan_rpc_retry_times=3
|
|||
# the follower send scanmap to leader rpc retry interval
|
||||
copyset.scan_rpc_retry_interval_us=100000
|
||||
# enable O_DSYNC when open chunkfile
|
||||
copyset.enable_odsync_when_open_chunkfile=true
|
||||
copyset.enable_odsync_when_open_chunkfile=false
|
||||
# sync trigger seconds
|
||||
copyset.sync_trigger_seconds=25
|
||||
# sync chunk limit default = 2MB
|
||||
|
|
|
|||
|
|
@ -13,12 +13,9 @@ global.chunk_size=16777216
|
|||
# chunk 元数据页大小,一般4KB
|
||||
global.meta_page_size=4096
|
||||
# clone chunk允许的最长location长度
|
||||
# chunk's block size, IO requests must align with it, supported value is |512| and |4096|
|
||||
# it should consist with `block_size` in chunkfilepool.meta_path and `mds.volume.blockSize` in MDS's configurations
|
||||
# for clone chunk and snapshot chunk, it's also the minimum granularity that each bit represents
|
||||
# if set to |512|, we need 4096 bytes bitmap for each chunk, so meta_page_size should be 8192 or larger.
|
||||
global.block_size=4096
|
||||
global.location_limit=3000
|
||||
# minimum alignment for io request
|
||||
global.min_io_alignment=512
|
||||
|
||||
#
|
||||
# MDS settings
|
||||
|
|
@ -111,7 +108,7 @@ copyset.scan_rpc_retry_times=3
|
|||
# the follower send scanmap to leader rpc retry interval
|
||||
copyset.scan_rpc_retry_interval_us=100000
|
||||
# enable O_DSYNC when open chunkfile
|
||||
copyset.enable_odsync_when_open_chunkfile=true
|
||||
copyset.enable_odsync_when_open_chunkfile=false
|
||||
# sync trigger seconds
|
||||
copyset.sync_trigger_seconds=25
|
||||
# sync chunk limit default = 2MB
|
||||
|
|
|
|||
|
|
@ -168,6 +168,13 @@ discard.granularity=4096
|
|||
# discard cleanup task delay times in millisecond
|
||||
discard.taskDelayMs=60000
|
||||
|
||||
##### alignment #####
|
||||
# default alignment
|
||||
global.alignment.commonVolume=512
|
||||
# alignment for clone volume
|
||||
# default is 4096, because lazy clone chunk bitmap granularity is 4096
|
||||
global.alignment.cloneVolume=4096
|
||||
|
||||
##### chunkserver client option #####
|
||||
# chunkserver client rpc timeout time
|
||||
csClientOpt.rpcTimeoutMs=500
|
||||
|
|
@ -181,3 +188,4 @@ csClientOpt.rpcMaxTimeoutMs=8000
|
|||
##### chunkserver broadcaster option #####
|
||||
# broad cast max machine num
|
||||
csBroadCasterOpt.broadCastMaxNum=200
|
||||
|
||||
|
|
|
|||
|
|
@ -159,3 +159,10 @@ discard.enable=false
|
|||
discard.granularity=4096
|
||||
# discard cleanup task delay times in millisecond
|
||||
discard.taskDelayMs=60000
|
||||
|
||||
##### alignment #####
|
||||
# default alignment
|
||||
global.alignment.commonVolume=512
|
||||
# alignment for clone volume
|
||||
# default is 4096, because lazy clone chunk bitmap granularity is 4096
|
||||
global.alignment.cloneVolume=4096
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ mds.topology.CreateCopysetRpcRetryTimes=20
|
|||
# 请求chunkserver上创建copyset重试间隔
|
||||
mds.topology.CreateCopysetRpcRetrySleepTimeMs=1000
|
||||
# Topology模块刷新metric时间间隔
|
||||
mds.topology.UpdateMetricIntervalSec=10
|
||||
mds.topology.UpdateMetricIntervalSec=60
|
||||
#和mds.chunkserver.failure.tolerance设置有关,一个zone 标准配置20台节点,如果允许3台节点failover,
|
||||
#那么剩余17台机器需要承载原先20台机器的空间,17/20=0.85,即使用量超过这个值即不再往这个池分配,
|
||||
#具体分为来两种情况, 当不使用chunkfilepool,物理池限制使用百分比,当使用 chunkfilepool 进行chunkfilepool分配时需预留failover空间,
|
||||
|
|
@ -197,8 +197,6 @@ mds.curvefs.defaultSegmentSize=1073741824
|
|||
mds.curvefs.minFileLength=10737418240
|
||||
# curvefs的默认最大文件大小,20TB = 20*1024*1024*1024*1024 = 21990232555520
|
||||
mds.curvefs.maxFileLength=21990232555520
|
||||
# smallest read/write unit for volume, support |512| and |4096|
|
||||
mds.curvefs.blockSize=4096
|
||||
|
||||
#
|
||||
# chunkseverclient config
|
||||
|
|
@ -239,16 +237,3 @@ mds.throttle.iopsPerGB=30
|
|||
mds.throttle.bpsMinInMB=120
|
||||
mds.throttle.bpsMaxInMB=260
|
||||
mds.throttle.bpsPerGBInMB=0.3
|
||||
|
||||
#
|
||||
## poolset rules
|
||||
#
|
||||
# for backward compatibility, rules are applied for select poolset when creating file
|
||||
#
|
||||
# for example
|
||||
# mds.poolset.rules=/dir1/:poolset1;/dir2/:poolset2;/dir1/sub/:sub
|
||||
#
|
||||
# when creating file reqeust doesn't have poolset, above rules are used to select poolset
|
||||
# - if filename is /dir1/file, then poolset1 is select
|
||||
# - if filename is /dir1/sub/file, then sub is select
|
||||
mds.poolset.rules=
|
||||
|
|
|
|||
|
|
@ -153,3 +153,10 @@ discard.enable=false
|
|||
discard.granularity=4096
|
||||
# discard cleanup task delay times in millisecond
|
||||
discard.taskDelayMs=60000
|
||||
|
||||
##### alignment #####
|
||||
# default alignment
|
||||
global.alignment.commonVolume=512
|
||||
# alignment for clone volume
|
||||
# default is 4096, because lazy clone chunk bitmap granularity is 4096
|
||||
global.alignment.cloneVolume=4096
|
||||
|
|
|
|||
|
|
@ -159,3 +159,10 @@ discard.enable=false
|
|||
discard.granularity=4096
|
||||
# discard cleanup task delay times in millisecond
|
||||
discard.taskDelayMs=60000
|
||||
|
||||
##### alignment #####
|
||||
# default alignment
|
||||
global.alignment.commonVolume=512
|
||||
# alignment for clone volume
|
||||
# default is 4096, because lazy clone chunk bitmap granularity is 4096
|
||||
global.alignment.cloneVolume=4096
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ chunkserver_walfilepool_retry_times: 5
|
|||
chunkserver_trash_expire_after_sec: 300
|
||||
chunkserver_trash_scan_period_sec: 120
|
||||
chunkserver_common_log_dir: ./runlog/
|
||||
chunkserver_min_io_alignment: 512
|
||||
|
||||
# 快照克隆配置默认值
|
||||
snap_client_config_path: /etc/curve/snap_client.conf
|
||||
|
|
@ -243,6 +244,8 @@ client_throttle_enable: false
|
|||
client_discard_enable: true
|
||||
client_discard_granularity: 4096
|
||||
client_discard_task_delay_ms: 60000
|
||||
client_alignment_common: 512
|
||||
client_alignment_clone: 4096
|
||||
|
||||
# nebd默认配置
|
||||
client_config_path: /etc/curve/client.conf
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ global.chunk_size={{ chunk_size }}
|
|||
global.meta_page_size={{ chunkserver_meta_page_size }}
|
||||
# clone chunk允许的最长location长度
|
||||
global.location_limit={{ chunkserver_location_limit }}
|
||||
# minimum alignment for io request
|
||||
global.min_io_alignment={{ chunkserver_min_io_alignment }}
|
||||
|
||||
#
|
||||
# MDS settings
|
||||
|
|
|
|||
|
|
@ -175,3 +175,10 @@ discard.enable={{ client_discard_enable }}
|
|||
discard.granularity={{ client_discard_granularity }}
|
||||
# discard cleanup task delay times in millisecond
|
||||
discard.taskDelayMs={{ client_discard_task_delay_ms }}
|
||||
|
||||
##### alignment #####
|
||||
# default alignment
|
||||
global.alignment.commonVolume={{ client_alignment_common }}
|
||||
# alignment for clone volume
|
||||
# default is 4096, because lazy clone chunk bitmap granularity is 4096
|
||||
global.alignment.cloneVolume={{ client_alignment_clone }}
|
||||
|
|
|
|||
|
|
@ -104,52 +104,23 @@ fuseClient.maxDataSize=1024
|
|||
fuseClient.refreshDataIntervalSec=30
|
||||
fuseClient.warmupThreadsNum=10
|
||||
|
||||
# the write throttle bps of fuseClient, default no limit
|
||||
fuseClient.throttle.avgWriteBytes=0
|
||||
# the write burst bps of fuseClient, default no limit
|
||||
fuseClient.throttle.burstWriteBytes=0
|
||||
# the times that write burst bps can continue, default 180s
|
||||
fuseClient.throttle.burstWriteBytesSecs=180
|
||||
|
||||
# the write throttle iops of fuseClient, default no limit
|
||||
fuseClient.throttle.avgWriteIops=0
|
||||
# the write burst iops of fuseClient, default no limit
|
||||
fuseClient.throttle.burstWriteIops=0
|
||||
# the times that write burst Iops can continue, default 180s
|
||||
fuseClient.throttle.burstWriteIopsSecs=180
|
||||
|
||||
# the read throttle bps of fuseClient, default no limit
|
||||
fuseClient.throttle.avgReadBytes=0
|
||||
# the read burst bps of fuseClient, default no limit
|
||||
fuseClient.throttle.burstReadBytes=0
|
||||
# the times that read burst bps can continue, default 180s
|
||||
fuseClient.throttle.burstReadBytesSecs=180
|
||||
|
||||
# the read throttle iops of fuseClient, default no limit
|
||||
fuseClient.throttle.avgReadIops=0
|
||||
# the read burst Iops of fuseClient, default no limit
|
||||
fuseClient.throttle.burstReadIops=0
|
||||
# the times that read burst Iops can continue, default 180s
|
||||
fuseClient.throttle.burstReadIopsSecs=180
|
||||
|
||||
#### filesystem metadata
|
||||
# {
|
||||
# fs.disableXattr:
|
||||
# if you want to get better metadata performance,
|
||||
# you can mount fs with |fs.disableXattr| is true
|
||||
# if you want to get curvefs specified xattr,
|
||||
# you can mount another fs with |fs.disableXattr| is true
|
||||
#
|
||||
# fs.lookupCache.negativeTimeoutSec:
|
||||
# fs.lookupCache.negativeTimeout:
|
||||
# entry which not found will be cached if |timeout| > 0
|
||||
fs.cto=true
|
||||
fs.maxNameLength=255
|
||||
fs.disableXattr=false
|
||||
fs.disableXattr=true
|
||||
fs.accessLogging=true
|
||||
fs.kernelCache.attrTimeoutSec=3600
|
||||
fs.kernelCache.dirAttrTimeoutSec=3600
|
||||
fs.kernelCache.entryTimeoutSec=3600
|
||||
fs.kernelCache.dirEntryTimeoutSec=3600
|
||||
fs.lookupCache.negativeTimeoutSec=0
|
||||
fs.lookupCache.minUses=1
|
||||
fs.kernelCache.attrTimeout=3600
|
||||
fs.kernelCache.dirAttrTimeout=3600
|
||||
fs.kernelCache.entryTimeout=3600
|
||||
fs.kernelCache.dirEntryTimeout=3600
|
||||
fs.lookupCache.negativeTimeout=0
|
||||
fs.lookupCache.lruSize=100000
|
||||
fs.dirCache.lruSize=5000000
|
||||
fs.openFile.lruSize=65536
|
||||
|
|
@ -180,6 +151,8 @@ volume.blockGroup.allocateOnce=4
|
|||
#### s3
|
||||
# this is for test. if s3.fakeS3=true, all data will be discarded
|
||||
s3.fakeS3=false
|
||||
# the max size that fuse send
|
||||
s3.fuseMaxSize=131072
|
||||
s3.pageSize=65536
|
||||
# prefetch blocks that disk cache use
|
||||
s3.prefetchBlocks=1
|
||||
|
|
@ -194,11 +167,8 @@ s3.baseSleepUs=500
|
|||
s3.threadScheduleInterval=3
|
||||
# data cache flush wait time
|
||||
s3.cacheFlushIntervalSec=5
|
||||
# write cache < 8,388,608 (8MB) is not allowed
|
||||
s3.writeCacheMaxByte=838860800
|
||||
s3.readCacheMaxByte=209715200
|
||||
# file cache read thread num
|
||||
s3.readCacheThreads=5
|
||||
# http = 0, https = 1
|
||||
s3.http_scheme=0
|
||||
s3.verify_SSL=False
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ mds.listen.addr=127.0.0.1:6700 #__CURVEADM_TEMPLATE__ ${service_addr}:${service
|
|||
mds.dummy.port=7700 # __CURVEADM_TEMPLATE__ ${service_dummy_port} __CURVEADM_TEMPLATE__ __ANSIBLE_TEMPLATE__ {{ curvefs_mds_listen_dummy_port }} __ANSIBLE_TEMPLATE__
|
||||
mds.common.logDir=/tmp/curvefs/mds # __CURVEADM_TEMPLATE__ ${prefix}/logs __CURVEADM_TEMPLATE__ __ANSIBLE_TEMPLATE__ /tmp/{{ inventory_hostname }}/curvefs/mds __ANSIBLE_TEMPLATE__
|
||||
mds.loglevel=0
|
||||
# If a connection does not read or write,it's treated as "idle" and will be closed by server soon.
|
||||
# Default value is -1 which disables the feature.
|
||||
mds.server.idleTimeoutSec=-1
|
||||
|
||||
#
|
||||
# space options
|
||||
|
|
|
|||
|
|
@ -128,25 +128,16 @@ copyset.trash.scan_periodsec=120
|
|||
# this config item should be tuned according cpu/memory/disk
|
||||
service.max_inflight_request=5000
|
||||
|
||||
#
|
||||
# Concurrent apply queue
|
||||
### concurrent apply queue options for each copyset
|
||||
### concurrent apply queue is used to isolate raft threads, each worker has its own queue
|
||||
### when a task can be applied it's been pushed into a corresponding read/write worker queue by certain rules
|
||||
### apply queue options for each copyset
|
||||
### apply queue is used to isolate raft threads, each worker has its own queue
|
||||
### when a task can be applied it's been pushed into a corresponding worker queue by certain rules
|
||||
# number of apply queue workers for each, each worker will start a indepent thread
|
||||
applyqueue.worker_count=3
|
||||
|
||||
# worker_count: number of apply queue workers for each, each worker will start a indepent thread
|
||||
# queue_depth: apply queue depth for each copyset
|
||||
# apply queue depth for each copyset
|
||||
# all tasks in queue must be done when do raft snapshot, and raft apply and raft snapshot are executed in same thread
|
||||
# so, if queue depth is too large, it will cause other tasks to wait too long for apply
|
||||
# write apply queue workers count
|
||||
applyqueue.write_worker_count=3
|
||||
# write apply queue depth
|
||||
applyqueue.write_queue_depth=1
|
||||
# read apply queue workers count
|
||||
applyqueue.read_worker_count=2
|
||||
# read apply queue depth
|
||||
applyqueue.read_queue_depth=1
|
||||
|
||||
applyqueue.queue_depth=1
|
||||
|
||||
# number of worker threads that created by brpc::Server
|
||||
# if set to |auto|, threads create by brpc::Server is equal to `getconf _NPROCESSORS_ONLN` + 1
|
||||
|
|
@ -154,10 +145,6 @@ applyqueue.read_queue_depth=1
|
|||
# it is recommended to set it to |auto| unless there is a significant performance improvement
|
||||
bthread.worker_count=auto
|
||||
|
||||
# If a connection does not read or write, it's treated as "idle" and will be closed by server soon.
|
||||
# Default value is -1 which disables the feature.
|
||||
server.idleTimeoutSec=-1
|
||||
|
||||
### Braft related flags
|
||||
### These configurations are ignored if the command line startup options are set
|
||||
# Call fsync when need
|
||||
|
|
@ -280,43 +267,3 @@ storage.rocksdb.perf_sampling_ratio=0
|
|||
# we will sending its with rpc streaming instead of
|
||||
# padding its into inode (default: 25000, about 25000 * 41 (byte) = 1MB)
|
||||
storage.s3_meta_inside_inode.limit_size=25000
|
||||
|
||||
# recycle options
|
||||
# metaserver scan recycle period, default 1h
|
||||
recycle.manager.scanPeriodSec=3600
|
||||
# metaserver recycle cleaner scan list dentry limit, default 1000
|
||||
recycle.cleaner.scanLimit=1000
|
||||
|
||||
#### excutorOpt
|
||||
# excutorOpt rpc with metaserver
|
||||
# rpc retry times with metaserver
|
||||
excutorOpt.maxRetry=4294967295
|
||||
# internal rpc retry times with metaserver
|
||||
excutorOpt.maxInternalRetry = 3
|
||||
# Retry sleep time between failed RPCs
|
||||
excutorOpt.retryIntervalUS=100000
|
||||
# RPC timeout for communicating with metaserver
|
||||
excutorOpt.rpcTimeoutMS=1000
|
||||
# RPC stream idle timeout
|
||||
excutorOpt.rpcStreamIdleTimeoutMS=500
|
||||
# The maximum timeout RPC time of the retry request.
|
||||
# The timeout time will follow the exponential backoff policy.
|
||||
# Because the timeout occurs when the network is congested, the RPC timeout needs to be increased
|
||||
excutorOpt.maxRPCTimeoutMS=8000
|
||||
# Maximum sleep time between retry requests.
|
||||
# when the network is congested or the metaserver is overloaded,
|
||||
# it is necessary to increase the sleep time
|
||||
excutorOpt.maxRetrySleepIntervalUS=8000000
|
||||
excutorOpt.minRetryTimesForceTimeoutBackoff=5
|
||||
excutorOpt.maxRetryTimesBeforeConsiderSuspend=20
|
||||
# batch limit of get inode attr and xattr
|
||||
excutorOpt.batchInodeAttrLimit=10000
|
||||
excutorOpt.enableMultiMountPointRename=true
|
||||
|
||||
#### metaCacheOpt
|
||||
# Gets the number of retries for the leader
|
||||
metaCacheOpt.metacacheGetLeaderRetry=3
|
||||
# Need to sleep for a period of time before each get leader retry
|
||||
metaCacheOpt.metacacheRPCRetryIntervalUS=100000
|
||||
# RPC timeout of get leader
|
||||
metaCacheOpt.metacacheGetLeaderRPCTimeOutMS=1000
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ volumeName=volume
|
|||
volumeUser=user
|
||||
volumePassword=password
|
||||
volumeBlockGroupSize=134217728
|
||||
volumeCluster=127.0.0.1:6666,127.0.0.1:6667,127.0.0.1:6668
|
||||
# support |AtStart| and |AtEnd|
|
||||
volumeBitmapLocation=AtStart
|
||||
# s3
|
||||
|
|
@ -35,12 +34,5 @@ s3.bucket_name=bucket
|
|||
s3.blocksize=4194304
|
||||
s3.chunksize=67108864
|
||||
s3.useVirtualAddressing=false
|
||||
# s3 objectPrefix, if set 0, means no prefix, if set 1, means inode prefix
|
||||
# if set 2 and other values mean hash prefix
|
||||
s3.objectPrefix=0
|
||||
# statistic info in xattr, hardlink will not be supported when enable
|
||||
enableSumInDir=true
|
||||
|
||||
# fs recycle, if set 0, disable fs recycle, delete files directly,
|
||||
# if set not 0, enable fs recycle, delete files after a period of time
|
||||
recycleTimeHour=0
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
FROM opencurvedocker/curve-base:debian10
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN mkdir -p /curvefs /etc/curvefs /core /etc/curve
|
||||
COPY curvefs /curvefs
|
||||
COPY entrypoint.sh /
|
||||
COPY curvefs/tools/sbin/curvefs_tool /usr/bin
|
||||
COPY libmemcached.so /usr/lib/
|
||||
COPY libmemcached.so.11 /usr/lib/
|
||||
COPY libhashkit.so.2 /usr/lib
|
||||
RUN chmod a+x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
FROM opencurvedocker/curve-base:debian10
|
||||
|
||||
RUN echo "deb http://mirrors.163.com/debian/ buster main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ buster main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \
|
||||
> /etc/apt/sources.list \
|
||||
&& apt-get clean \
|
||||
&& apt-get -y update \
|
||||
&& apt-get -y install \
|
||||
gcc \
|
||||
gdb \
|
||||
make \
|
||||
openssl \
|
||||
net-tools \
|
||||
libcurl3-gnutls \
|
||||
perl \
|
||||
linux-perf \
|
||||
vim \
|
||||
curl \
|
||||
cron \
|
||||
procps \
|
||||
lsof \
|
||||
nginx \
|
||||
less \
|
||||
fuse3 \
|
||||
libnl-3-200 \
|
||||
libnl-genl-3-200 \
|
||||
libjemalloc2 \
|
||||
libsnappy1v5 \
|
||||
liblz4-1 \
|
||||
zlib1g \
|
||||
&& ln -sf /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so
|
||||
|
||||
COPY libetcdclient.so /usr/lib/
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.PHONY: build
|
||||
|
||||
build:
|
||||
docker build -t opencurvedocker/curve-base:debian10 .
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
FROM opencurvedocker/curve-base:build-debian10
|
||||
|
||||
RUN echo "deb http://mirrors.163.com/debian/ buster main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ buster main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \
|
||||
> /etc/apt/sources.list \
|
||||
&& apt-get clean \
|
||||
&& apt-get -y update \
|
||||
&& apt-get -y install \
|
||||
wget \
|
||||
git \
|
||||
gcc \
|
||||
g++ \
|
||||
clang \
|
||||
libssl-dev \
|
||||
libnl-genl-3-dev \
|
||||
libcurl4-gnutls-dev \
|
||||
uuid-dev \
|
||||
libfiu-dev \
|
||||
libfuse3-dev \
|
||||
zlib1g-dev \
|
||||
make \
|
||||
openjdk-11-jdk \
|
||||
sudo \
|
||||
zlib1g-dev \
|
||||
libsnappy-dev \
|
||||
liblz4-dev \
|
||||
cmake \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
lsb-release \
|
||||
curl \
|
||||
git \
|
||||
&& mkdir -p /etc/apt/keyrings \
|
||||
&& curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
|
||||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y docker-ce docker-ce-cli containerd.io \
|
||||
&& wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 \
|
||||
&& mv bazelisk-linux-amd64 /usr/bin/bazelisk \
|
||||
&& ln -sf /usr/bin/bazelisk /usr/bin/bazel \
|
||||
&& wget https://github.com/bazelbuild/bazel/releases/download/4.2.2/bazel-4.2.2-linux-x86_64 \
|
||||
&& mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \
|
||||
&& mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \
|
||||
&& chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.PHONY: build
|
||||
|
||||
build:
|
||||
docker build -t opencurvedocker/curve-base:build-debian10 .
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc.
|
||||
|
||||
############################ GLOBAL VARIABLES
|
||||
g_role=""
|
||||
g_args=""
|
||||
g_prefix=""
|
||||
g_binary=""
|
||||
g_start_args=""
|
||||
|
||||
############################ BASIC FUNCTIONS
|
||||
function msg() {
|
||||
printf '%b' "$1" >&2
|
||||
}
|
||||
|
||||
function success() {
|
||||
msg "\33[32m[✔]\33[0m ${1}${2}"
|
||||
}
|
||||
|
||||
function die() {
|
||||
msg "\33[31m[✘]\33[0m ${1}${2}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
############################ FUNCTIONS
|
||||
function usage () {
|
||||
cat << _EOC_
|
||||
Usage:
|
||||
entrypoint.sh --role=ROLE
|
||||
entrypoint.sh --role=ROLE --args=ARGS
|
||||
|
||||
Examples:
|
||||
entrypoint.sh --role=etcd
|
||||
entrypoint.sh --role=client --args="-o default_permissions"
|
||||
_EOC_
|
||||
}
|
||||
|
||||
function get_options() {
|
||||
local long_opts="role:,args:,help"
|
||||
local args=`getopt -o ra --long $long_opts -n "$0" -- "$@"`
|
||||
eval set -- "${args}"
|
||||
while true
|
||||
do
|
||||
case "$1" in
|
||||
-r|--role)
|
||||
g_role=$2
|
||||
shift 2
|
||||
;;
|
||||
-a|--args)
|
||||
g_args=$2
|
||||
shift 2
|
||||
;;
|
||||
-h)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function prepare() {
|
||||
g_prefix="/curvefs/$g_role"
|
||||
conf_path="$g_prefix/conf/$g_role.conf"
|
||||
|
||||
case $g_role in
|
||||
etcd)
|
||||
g_binary="$g_prefix/sbin/etcd"
|
||||
g_start_args="--config-file $conf_path"
|
||||
;;
|
||||
mds)
|
||||
g_binary="$g_prefix/sbin/curvefs-mds"
|
||||
g_start_args="--confPath $conf_path"
|
||||
;;
|
||||
metaserver)
|
||||
g_binary="$g_prefix/sbin/curvefs-metaserver"
|
||||
g_start_args="--confPath $conf_path"
|
||||
;;
|
||||
client)
|
||||
g_binary="$g_prefix/sbin/curve-fuse"
|
||||
g_start_args="--confPath $conf_path"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$g_args" != "" ]; then
|
||||
g_start_args=$g_args
|
||||
fi
|
||||
}
|
||||
|
||||
function create_directory() {
|
||||
chmod 700 "$g_prefix/data"
|
||||
if [ "$g_role" == "etcd" ]; then
|
||||
mkdir -p "$g_prefix/data/wal"
|
||||
elif [ "$g_role" == "metaserver" ]; then
|
||||
mkdir -p "$g_prefix/data/storage"
|
||||
elif [ "$g_role" == "client" ]; then
|
||||
mkdir -p "$g_prefix/mnt"
|
||||
fi
|
||||
}
|
||||
|
||||
function main() {
|
||||
get_options "$@"
|
||||
|
||||
prepare
|
||||
create_directory
|
||||
[[ $(command -v crontab) ]] && cron
|
||||
if [ $g_role == "etcd" ]; then
|
||||
exec $g_binary $g_start_args >>$g_prefix/logs/etcd.log 2>&1
|
||||
else
|
||||
exec $g_binary $g_start_args
|
||||
fi
|
||||
}
|
||||
|
||||
############################ MAIN()
|
||||
main "$@"
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
FROM opencurvedocker/curve-base:debian11
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN mkdir -p /curvefs /etc/curvefs /core /etc/curve
|
||||
COPY curvefs /curvefs
|
||||
COPY entrypoint.sh /
|
||||
COPY curvefs/tools/sbin/curvefs_tool /usr/bin
|
||||
COPY libmemcached.so /usr/lib/
|
||||
COPY libmemcached.so.11 /usr/lib/
|
||||
COPY libhashkit.so.2 /usr/lib
|
||||
RUN chmod a+x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
FROM opencurvedocker/curve-base:debian11
|
||||
|
||||
RUN echo "deb http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \
|
||||
> /etc/apt/sources.list \
|
||||
&& apt-get clean \
|
||||
&& apt-get -y update \
|
||||
&& apt-get -y install \
|
||||
gcc \
|
||||
gdb \
|
||||
make \
|
||||
openssl \
|
||||
net-tools \
|
||||
libcurl3-gnutls \
|
||||
perl \
|
||||
linux-perf \
|
||||
vim \
|
||||
curl \
|
||||
cron \
|
||||
procps \
|
||||
lsof \
|
||||
nginx \
|
||||
less \
|
||||
fuse3 \
|
||||
libnl-3-200 \
|
||||
libnl-genl-3-200 \
|
||||
libjemalloc2 \
|
||||
libsnappy1v5 \
|
||||
liblz4-1 \
|
||||
zlib1g
|
||||
&& ln -sf /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so
|
||||
|
||||
COPY libetcdclient.so /usr/lib/
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.PHONY: build
|
||||
|
||||
build:
|
||||
docker build -t opencurvedocker/curve-base:debian11 .
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
FROM opencurvedocker/curve-base:build-debian11
|
||||
|
||||
RUN echo "deb http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \
|
||||
> /etc/apt/sources.list \
|
||||
&& apt-get clean \
|
||||
&& apt-get -y update \
|
||||
&& apt-get -y install \
|
||||
wget \
|
||||
git \
|
||||
gcc \
|
||||
g++ \
|
||||
clang \
|
||||
libssl-dev \
|
||||
libnl-genl-3-dev \
|
||||
libcurl4-gnutls-dev \
|
||||
uuid-dev \
|
||||
libfiu-dev \
|
||||
libfuse3-dev \
|
||||
zlib1g-dev \
|
||||
make \
|
||||
openjdk-11-jdk \
|
||||
sudo \
|
||||
libsnappy-dev \
|
||||
liblz4-dev \
|
||||
cmake \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
lsb-release \
|
||||
curl \
|
||||
git \
|
||||
&& mkdir -p /etc/apt/keyrings \
|
||||
# && curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
|
||||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y docker-ce docker-ce-cli containerd.io \
|
||||
&& wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 \
|
||||
&& mv bazelisk-linux-amd64 /usr/bin/bazelisk \
|
||||
&& ln -sf /usr/bin/bazelisk /usr/bin/bazel \
|
||||
&& wget https://github.com/bazelbuild/bazel/releases/download/4.2.2/bazel-4.2.2-linux-x86_64 \
|
||||
&& mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \
|
||||
&& mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \
|
||||
&& chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.PHONY: build
|
||||
|
||||
build:
|
||||
docker build -t opencurvedocker/curve-base:build-debian11 .
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc.
|
||||
|
||||
############################ GLOBAL VARIABLES
|
||||
g_role=""
|
||||
g_args=""
|
||||
g_prefix=""
|
||||
g_binary=""
|
||||
g_start_args=""
|
||||
|
||||
############################ BASIC FUNCTIONS
|
||||
function msg() {
|
||||
printf '%b' "$1" >&2
|
||||
}
|
||||
|
||||
function success() {
|
||||
msg "\33[32m[✔]\33[0m ${1}${2}"
|
||||
}
|
||||
|
||||
function die() {
|
||||
msg "\33[31m[✘]\33[0m ${1}${2}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
############################ FUNCTIONS
|
||||
function usage () {
|
||||
cat << _EOC_
|
||||
Usage:
|
||||
entrypoint.sh --role=ROLE
|
||||
entrypoint.sh --role=ROLE --args=ARGS
|
||||
|
||||
Examples:
|
||||
entrypoint.sh --role=etcd
|
||||
entrypoint.sh --role=client --args="-o default_permissions"
|
||||
_EOC_
|
||||
}
|
||||
|
||||
function get_options() {
|
||||
local long_opts="role:,args:,help"
|
||||
local args=`getopt -o ra --long $long_opts -n "$0" -- "$@"`
|
||||
eval set -- "${args}"
|
||||
while true
|
||||
do
|
||||
case "$1" in
|
||||
-r|--role)
|
||||
g_role=$2
|
||||
shift 2
|
||||
;;
|
||||
-a|--args)
|
||||
g_args=$2
|
||||
shift 2
|
||||
;;
|
||||
-h)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function prepare() {
|
||||
g_prefix="/curvefs/$g_role"
|
||||
conf_path="$g_prefix/conf/$g_role.conf"
|
||||
|
||||
case $g_role in
|
||||
etcd)
|
||||
g_binary="$g_prefix/sbin/etcd"
|
||||
g_start_args="--config-file $conf_path"
|
||||
;;
|
||||
mds)
|
||||
g_binary="$g_prefix/sbin/curvefs-mds"
|
||||
g_start_args="--confPath $conf_path"
|
||||
;;
|
||||
metaserver)
|
||||
g_binary="$g_prefix/sbin/curvefs-metaserver"
|
||||
g_start_args="--confPath $conf_path"
|
||||
;;
|
||||
client)
|
||||
g_binary="$g_prefix/sbin/curve-fuse"
|
||||
g_start_args="--confPath $conf_path"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$g_args" != "" ]; then
|
||||
g_start_args=$g_args
|
||||
fi
|
||||
}
|
||||
|
||||
function create_directory() {
|
||||
chmod 700 "$g_prefix/data"
|
||||
if [ "$g_role" == "etcd" ]; then
|
||||
mkdir -p "$g_prefix/data/wal"
|
||||
elif [ "$g_role" == "metaserver" ]; then
|
||||
mkdir -p "$g_prefix/data/storage"
|
||||
elif [ "$g_role" == "client" ]; then
|
||||
mkdir -p "$g_prefix/mnt"
|
||||
fi
|
||||
}
|
||||
|
||||
function main() {
|
||||
get_options "$@"
|
||||
|
||||
prepare
|
||||
create_directory
|
||||
[[ $(command -v crontab) ]] && cron
|
||||
if [ $g_role == "etcd" ]; then
|
||||
exec $g_binary $g_start_args >>$g_prefix/logs/etcd.log 2>&1
|
||||
else
|
||||
exec $g_binary $g_start_args
|
||||
fi
|
||||
}
|
||||
|
||||
############################ MAIN()
|
||||
main "$@"
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
FROM opencurvedocker/curve-base:debian9
|
||||
ENV TZ=Asia/Shanghai
|
||||
COPY entrypoint.sh /
|
||||
COPY curvefs /curvefs
|
||||
COPY libmemcached.so libmemcached.so.11 libhashkit.so.2 /usr/lib/
|
||||
RUN mkdir -p /etc/curvefs /core /etc/curve && chmod a+x /entrypoint.sh \
|
||||
&& cp /curvefs/tools/sbin/curvefs_tool /usr/bin \
|
||||
&& cp /curvefs/tools-v2/sbin/curve /usr/bin/
|
||||
&& cp curvefs/tools-v2/sbin/curve /usr/bin/
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
FROM opencurvedocker/curve-base:debian9
|
||||
|
||||
RUN echo "deb http://mirrors.163.com/debian/ stretch main\n" \
|
||||
"deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib\n" \
|
||||
"deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib\n" \
|
||||
"deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib\n" \
|
||||
"deb http://httpredir.debian.org/debian stretch-backports main contrib non-free\n" \
|
||||
> /etc/apt/sources.list \
|
||||
&& apt-get clean \
|
||||
&& apt-get -y update \
|
||||
&& apt-get -y install \
|
||||
gcc \
|
||||
gdb \
|
||||
make \
|
||||
openssl \
|
||||
net-tools \
|
||||
libcurl3-gnutls \
|
||||
podlators-perl \
|
||||
linux-perf \
|
||||
vim \
|
||||
curl \
|
||||
cron \
|
||||
procps \
|
||||
lsof \
|
||||
nginx \
|
||||
less \
|
||||
zlib1g \
|
||||
libsnappy1v5 \
|
||||
liblz4-1 \
|
||||
python \
|
||||
wget \
|
||||
python3 \
|
||||
&& wget https://curve-build.nos-eastchina1.126.net/curve-base.tar.gz \
|
||||
&& tar -xzvf curve-base.tar.gz
|
||||
COPY fusermount3 /usr/local/bin
|
||||
COPY libetcdclient.so /usr/lib/
|
||||
COPY libfuse3.so libfuse3.so.3 libfuse3.so.3.10.5 libnl-3.so.200 libnl-genl-3.so.200 /usr/lib/x86_64-linux-gnu/
|
||||
COPY libjemalloc.so libjemalloc.so.1 libjemalloc.so.2 /usr/local/lib/
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.PHONY: build
|
||||
|
||||
build:
|
||||
docker build -t opencurvedocker/curve-base:debian9 .
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
FROM opencurvedocker/curve-base:build-debian9
|
||||
|
||||
RUN apt-get clean \
|
||||
&& apt-get -y update \
|
||||
&& apt-get -y install \
|
||||
g++ \
|
||||
wget \
|
||||
clang \
|
||||
git \
|
||||
libnl-genl-3-dev \
|
||||
libssl-dev \
|
||||
uuid-dev \
|
||||
libcurl4-gnutls-dev \
|
||||
libfiu-dev \
|
||||
openjdk-8-jdk \
|
||||
sudo \
|
||||
python-dev \
|
||||
python-setuptools \
|
||||
python-wheel \
|
||||
python3-dev \
|
||||
python3-setuptools \
|
||||
python3-wheel \
|
||||
zlib1g-dev \
|
||||
libsnappy-dev \
|
||||
liblz4-dev \
|
||||
cmake \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
lsb-release \
|
||||
curl \
|
||||
apt-transport-https \
|
||||
git \
|
||||
&& mkdir -p /etc/apt/keyrings \
|
||||
&& curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
|
||||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y docker-ce docker-ce-cli containerd.io \
|
||||
&& wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 \
|
||||
&& mv bazelisk-linux-amd64 /usr/bin/bazelisk \
|
||||
&& ln -sf /usr/bin/bazelisk /usr/bin/bazel \
|
||||
&& wget https://github.com/bazelbuild/bazel/releases/download/4.2.2/bazel-4.2.2-linux-x86_64 \
|
||||
&& mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \
|
||||
&& mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \
|
||||
&& wget https://github.com/bazelbuild/bazel/releases/download/0.17.2/bazel-0.17.2-linux-x86_64 \
|
||||
&& mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-0.17.2-linux-x86_64/bin \
|
||||
&& mv bazel-0.17.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-0.17.2-linux-x86_64/bin/bazel \
|
||||
&& chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /root/.cache/bazelisk/downloads/bazelbuild/bazel-0.17.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk
|
||||
COPY fuse3/* /usr/include/fuse3/
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.PHONY: build
|
||||
|
||||
build:
|
||||
docker build -t opencurvedocker/curve-base:build-debian9 .
|
||||
|
|
@ -8,7 +8,6 @@ g_args=""
|
|||
g_prefix=""
|
||||
g_binary=""
|
||||
g_start_args=""
|
||||
g_preexec="/curvefs/tools-v2/sbin/daemon"
|
||||
|
||||
############################ BASIC FUNCTIONS
|
||||
function msg() {
|
||||
|
|
@ -120,7 +119,6 @@ function main() {
|
|||
prepare
|
||||
create_directory
|
||||
[[ $(command -v crontab) ]] && cron
|
||||
[[ ! -z $g_preexec ]] && $g_preexec &
|
||||
if [ $g_role == "etcd" ]; then
|
||||
exec $g_binary $g_start_args >>$g_prefix/logs/etcd.log 2>&1
|
||||
elif [ $g_role == "monitor" ]; then
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ message S3Info {
|
|||
required string bucketname = 4;
|
||||
required uint64 blockSize = 5;
|
||||
required uint64 chunkSize = 6;
|
||||
optional uint32 objectPrefix = 7;
|
||||
}
|
||||
|
||||
enum PartitionStatus {
|
||||
|
|
@ -84,7 +83,6 @@ message PartitionInfo {
|
|||
optional uint64 inodeNum = 10; // hearbeat upload this value to mds topo, topo/metaserver needn't persist this value
|
||||
optional uint64 dentryNum = 11; // hearbeat upload this value to mds topo, topo/metaserver needn't persist this value
|
||||
map<int32, uint64> fileType2inodeNum = 12;
|
||||
optional bool manageFlag = 13; // if a partition has recyclebin inode, set this flag true
|
||||
}
|
||||
|
||||
message Peer {
|
||||
|
|
|
|||
|
|
@ -56,10 +56,6 @@ enum FSStatusCode {
|
|||
VOLUME_INFO_ERROR = 31;
|
||||
MOUNT_POINT_CONFLICT = 32;
|
||||
FSNAME_INVALID = 33;
|
||||
INSERT_DENTRY_FAIL = 34;
|
||||
INSERT_MANAGE_INODE_FAIL = 35;
|
||||
DELETE_DENTRY_FAIL = 36;
|
||||
UPDATE_FS_FAIL = 37;
|
||||
}
|
||||
|
||||
// fs interface
|
||||
|
|
@ -101,7 +97,6 @@ message FsInfo {
|
|||
required string owner = 12;
|
||||
optional uint64 txSequence = 13;
|
||||
optional string txOwner = 14;
|
||||
optional uint32 recycleTimeHour =15;
|
||||
}
|
||||
|
||||
message GetFsInfoResponse {
|
||||
|
|
@ -117,7 +112,6 @@ message CreateFsRequest {
|
|||
required bool enableSumInDir = 5;
|
||||
required string owner = 6;
|
||||
required uint64 capacity = 7;
|
||||
optional uint32 recycleTimeHour = 8;
|
||||
}
|
||||
|
||||
message CreateFsResponse {
|
||||
|
|
@ -191,7 +185,6 @@ message RefreshSessionRequest {
|
|||
message RefreshSessionResponse {
|
||||
required FSStatusCode statusCode = 1;
|
||||
repeated topology.PartitionTxId latestTxIdList = 2;
|
||||
optional bool enableSumInDir = 3;
|
||||
}
|
||||
|
||||
message DLockValue {
|
||||
|
|
|
|||
|
|
@ -272,28 +272,6 @@ message CreateRootInodeResponse {
|
|||
optional uint64 appliedIndex = 2;
|
||||
}
|
||||
|
||||
enum ManageInodeType {
|
||||
TYPE_NOT_MANAGE = 0;
|
||||
TYPE_RECYCLE = 1;
|
||||
};
|
||||
|
||||
message CreateManageInodeRequest {
|
||||
required uint32 poolId = 1;
|
||||
required uint32 copysetId = 2;
|
||||
required uint32 partitionId = 3;
|
||||
required uint32 fsId = 4;
|
||||
required uint32 uid = 5;
|
||||
required uint32 gid = 6;
|
||||
required uint32 mode = 7;
|
||||
required ManageInodeType manageType = 8;
|
||||
}
|
||||
|
||||
message CreateManageInodeResponse {
|
||||
required MetaStatusCode statusCode = 1;
|
||||
optional Inode inode = 2;
|
||||
optional uint64 appliedIndex = 3;
|
||||
}
|
||||
|
||||
message UpdateInodeRequest {
|
||||
required uint32 poolId = 1;
|
||||
required uint32 copysetId = 2;
|
||||
|
|
@ -496,7 +474,6 @@ service MetaServerService {
|
|||
rpc DeleteInode(DeleteInodeRequest) returns (DeleteInodeResponse);
|
||||
rpc CreateRootInode(CreateRootInodeRequest) returns
|
||||
(CreateRootInodeResponse);
|
||||
rpc CreateManageInode(CreateManageInodeRequest) returns (CreateManageInodeResponse);
|
||||
rpc GetOrModifyS3ChunkInfo(GetOrModifyS3ChunkInfoRequest) returns (GetOrModifyS3ChunkInfoResponse);
|
||||
rpc BatchGetInodeAttr(BatchGetInodeAttrRequest) returns (BatchGetInodeAttrResponse);
|
||||
rpc BatchGetXAttr(BatchGetXAttrRequest) returns (BatchGetXAttrResponse);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ cc_library(
|
|||
"//curvefs/src/common:threading",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@com_google_absl//absl/meta:type_traits",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ void UpdateInodeAttrAndExtentClosure::Run() {
|
|||
<< ", inode: " << inode_->GetInodeId();
|
||||
inode_->MarkInodeError();
|
||||
}
|
||||
inode_->ClearDirty();
|
||||
|
||||
inode_->syncingVolumeExtentsMtx_.unlock();
|
||||
inode_->ReleaseSyncingInode();
|
||||
|
||||
|
|
|
|||
|
|
@ -397,27 +397,6 @@ CURVEFS_ERROR RenameOperator::UpdateInodeParent() {
|
|||
return rc;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR RenameOperator::UpdateInodeCtime() {
|
||||
std::shared_ptr<InodeWrapper> inodeWrapper;
|
||||
auto rc = inodeManager_->GetInode(srcDentry_.inodeid(), inodeWrapper);
|
||||
if (rc != CURVEFS_ERROR::OK) {
|
||||
LOG_ERROR("GetInode", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
curve::common::UniqueLock lk = inodeWrapper->GetUniqueLock();
|
||||
inodeWrapper->UpdateTimestampLocked(kChangeTime);
|
||||
|
||||
rc = inodeWrapper->SyncAttr();
|
||||
if (rc != CURVEFS_ERROR::OK) {
|
||||
LOG_ERROR("UpdateInodeCtime", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
LOG(INFO) << "UpdateInodeCtime inodeid = " << srcDentry_.inodeid();
|
||||
return rc;
|
||||
}
|
||||
|
||||
void RenameOperator::UpdateCache() {
|
||||
SetTxId(srcPartitionId_, srcTxId_ + 1);
|
||||
SetTxId(dstPartitionId_, dstTxId_ + 1);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ class RenameOperator {
|
|||
CURVEFS_ERROR UnlinkSrcParentInode();
|
||||
void UnlinkOldInode();
|
||||
CURVEFS_ERROR UpdateInodeParent();
|
||||
CURVEFS_ERROR UpdateInodeCtime();
|
||||
void UpdateCache();
|
||||
|
||||
void GetOldInode(uint64_t *oldInodeId, int64_t *oldInodeSize,
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@
|
|||
*/
|
||||
|
||||
#include "curvefs/src/client/common/common.h"
|
||||
#include "src/common/string_util.h"
|
||||
|
||||
namespace curvefs {
|
||||
namespace client {
|
||||
namespace common {
|
||||
|
|
@ -105,59 +103,6 @@ WarmupType GetWarmupType(const std::string& type) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
const char kCurveFsWarmupStorageDisk[] = "disk";
|
||||
const char kCurveFsWarmupStorageKvclient[] = "kvclient";
|
||||
|
||||
WarmupStorageType GetWarmupStorageType(const std::string &type) {
|
||||
auto ret = WarmupStorageType::kWarmupStorageTypeUnknown;
|
||||
if (type == kCurveFsWarmupStorageDisk) {
|
||||
ret = WarmupStorageType::kWarmupStorageTypeDisk;
|
||||
} else if (type == kCurveFsWarmupStorageKvclient) {
|
||||
ret = WarmupStorageType::kWarmupStorageTypeKvClient;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
using ::curve::common::StringToUll;
|
||||
|
||||
// if direction is true means '+', false means '-'
|
||||
// is direction is true, add second to first
|
||||
// if direction is false, sub second from first
|
||||
bool AddUllStringToFirst(std::string *first, uint64_t second, bool direction) {
|
||||
uint64_t firstNum = 0;
|
||||
uint64_t secondNum = second;
|
||||
if (StringToUll(*first, &firstNum)) {
|
||||
if (direction) {
|
||||
*first = std::to_string(firstNum + secondNum);
|
||||
} else {
|
||||
if (firstNum < secondNum) {
|
||||
*first = std::to_string(0);
|
||||
LOG(WARNING) << "AddUllStringToFirst failed when minus,"
|
||||
<< " first = " << firstNum
|
||||
<< ", second = " << secondNum;
|
||||
return false;
|
||||
}
|
||||
*first = std::to_string(firstNum - secondNum);
|
||||
}
|
||||
} else {
|
||||
LOG(ERROR) << "StringToUll failed, first = " << *first
|
||||
<< ", second = " << second;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AddUllStringToFirst(uint64_t *first, const std::string &second) {
|
||||
uint64_t secondNum = 0;
|
||||
if (StringToUll(second, &secondNum)) {
|
||||
*first += secondNum;
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG(ERROR) << "StringToUll failed, second = " << second;
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace client
|
||||
} // namespace curvefs
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ enum class MetaServerOpType {
|
|||
GetOrModifyS3ChunkInfo,
|
||||
GetVolumeExtent,
|
||||
UpdateVolumeExtent,
|
||||
CreateManageInode,
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, MetaServerOpType optype);
|
||||
|
|
@ -69,9 +68,6 @@ const uint32_t MAX_XATTR_VALUE_LENGTH = 64 * 1024;
|
|||
|
||||
const char kCurveFsWarmupXAttr[] = "curvefs.warmup.op";
|
||||
|
||||
|
||||
constexpr int kWarmupOpNum = 4;
|
||||
|
||||
enum class WarmupOpType {
|
||||
kWarmupOpUnknown = 0,
|
||||
kWarmupOpAdd = 1,
|
||||
|
|
@ -86,15 +82,7 @@ enum class WarmupType {
|
|||
kWarmupTypeSingle = 2,
|
||||
};
|
||||
|
||||
WarmupType GetWarmupType(const std::string &type);
|
||||
|
||||
enum class WarmupStorageType {
|
||||
kWarmupStorageTypeUnknown = 0,
|
||||
kWarmupStorageTypeDisk = 1,
|
||||
kWarmupStorageTypeKvClient = 2,
|
||||
};
|
||||
|
||||
WarmupStorageType GetWarmupStorageType(const std::string &type);
|
||||
WarmupType GetWarmupType(const std::string& type);
|
||||
|
||||
enum class FileHandle : uint64_t {
|
||||
kDefaultValue = 0,
|
||||
|
|
@ -106,11 +94,6 @@ enum class NlinkChange : int32_t {
|
|||
kSubOne = -1,
|
||||
};
|
||||
|
||||
// if direction is true means '+', false means '-'
|
||||
// is direction is true, add second to first
|
||||
// if direction is false, sub second from first
|
||||
bool AddUllStringToFirst(std::string *first, uint64_t second, bool direction);
|
||||
bool AddUllStringToFirst(uint64_t *first, const std::string &second);
|
||||
} // namespace common
|
||||
} // namespace client
|
||||
} // namespace curvefs
|
||||
|
|
|
|||
|
|
@ -52,55 +52,6 @@ DEFINE_bool(useFakeS3, false,
|
|||
DEFINE_bool(supportKVcache, false, "use kvcache to speed up sharing");
|
||||
DEFINE_bool(access_logging, true, "enable access log");
|
||||
|
||||
/**
|
||||
* use curl -L fuseclient:port/flags/fuseClientAvgWriteBytes?setvalue=true
|
||||
* for dynamic parameter configuration
|
||||
*/
|
||||
static bool pass_uint64(const char *, uint64_t) { return true; }
|
||||
|
||||
DEFINE_uint64(fuseClientAvgWriteBytes, 0,
|
||||
"the write throttle bps of fuse client");
|
||||
DEFINE_validator(fuseClientAvgWriteBytes, &pass_uint64);
|
||||
DEFINE_uint64(fuseClientBurstWriteBytes, 0,
|
||||
"the write burst bps of fuse client");
|
||||
DEFINE_validator(fuseClientBurstWriteBytes, &pass_uint64);
|
||||
DEFINE_uint64(fuseClientBurstWriteBytesSecs, 180,
|
||||
"the times that write burst bps can continue");
|
||||
DEFINE_validator(fuseClientBurstWriteBytesSecs, &pass_uint64);
|
||||
|
||||
|
||||
DEFINE_uint64(fuseClientAvgWriteIops, 0,
|
||||
"the write throttle iops of fuse client");
|
||||
DEFINE_validator(fuseClientAvgWriteIops, &pass_uint64);
|
||||
DEFINE_uint64(fuseClientBurstWriteIops, 0,
|
||||
"the write burst iops of fuse client");
|
||||
DEFINE_validator(fuseClientBurstWriteIops, &pass_uint64);
|
||||
DEFINE_uint64(fuseClientBurstWriteIopsSecs, 180,
|
||||
"the times that write burst iops can continue");
|
||||
DEFINE_validator(fuseClientBurstWriteIopsSecs, &pass_uint64);
|
||||
|
||||
|
||||
DEFINE_uint64(fuseClientAvgReadBytes, 0,
|
||||
"the Read throttle bps of fuse client");
|
||||
DEFINE_validator(fuseClientAvgReadBytes, &pass_uint64);
|
||||
DEFINE_uint64(fuseClientBurstReadBytes, 0,
|
||||
"the Read burst bps of fuse client");
|
||||
DEFINE_validator(fuseClientBurstReadBytes, &pass_uint64);
|
||||
DEFINE_uint64(fuseClientBurstReadBytesSecs, 180,
|
||||
"the times that Read burst bps can continue");
|
||||
DEFINE_validator(fuseClientBurstReadBytesSecs, &pass_uint64);
|
||||
|
||||
|
||||
DEFINE_uint64(fuseClientAvgReadIops, 0,
|
||||
"the Read throttle iops of fuse client");
|
||||
DEFINE_validator(fuseClientAvgReadIops, &pass_uint64);
|
||||
DEFINE_uint64(fuseClientBurstReadIops, 0,
|
||||
"the Read burst iops of fuse client");
|
||||
DEFINE_validator(fuseClientBurstReadIops, &pass_uint64);
|
||||
DEFINE_uint64(fuseClientBurstReadIopsSecs, 180,
|
||||
"the times that Read burst iops can continue");
|
||||
DEFINE_validator(fuseClientBurstReadIopsSecs, &pass_uint64);
|
||||
|
||||
void InitMdsOption(Configuration *conf, MdsOption *mdsOpt) {
|
||||
conf->GetValueFatalIfFail("mdsOpt.mdsMaxRetryMS", &mdsOpt->mdsMaxRetryMS);
|
||||
conf->GetValueFatalIfFail("mdsOpt.rpcRetryOpt.maxRPCTimeoutMS",
|
||||
|
|
@ -207,6 +158,8 @@ void InitDiskCacheOption(Configuration *conf,
|
|||
|
||||
void InitS3Option(Configuration *conf, S3Option *s3Opt) {
|
||||
conf->GetValueFatalIfFail("s3.fakeS3", &FLAGS_useFakeS3);
|
||||
conf->GetValueFatalIfFail("s3.fuseMaxSize",
|
||||
&s3Opt->s3ClientAdaptorOpt.fuseMaxSize);
|
||||
conf->GetValueFatalIfFail("s3.pageSize",
|
||||
&s3Opt->s3ClientAdaptorOpt.pageSize);
|
||||
conf->GetValueFatalIfFail("s3.prefetchBlocks",
|
||||
|
|
@ -223,8 +176,6 @@ void InitS3Option(Configuration *conf, S3Option *s3Opt) {
|
|||
&s3Opt->s3ClientAdaptorOpt.writeCacheMaxByte);
|
||||
conf->GetValueFatalIfFail("s3.readCacheMaxByte",
|
||||
&s3Opt->s3ClientAdaptorOpt.readCacheMaxByte);
|
||||
conf->GetValueFatalIfFail("s3.readCacheThreads",
|
||||
&s3Opt->s3ClientAdaptorOpt.readCacheThreads);
|
||||
conf->GetValueFatalIfFail("s3.nearfullRatio",
|
||||
&s3Opt->s3ClientAdaptorOpt.nearfullRatio);
|
||||
conf->GetValueFatalIfFail("s3.baseSleepUs",
|
||||
|
|
@ -299,43 +250,36 @@ void InitFileSystemOption(Configuration* c, FileSystemOption* option) {
|
|||
c->GetValueFatalIfFail("fs.disableXattr", &option->disableXattr);
|
||||
c->GetValueFatalIfFail("fs.maxNameLength", &option->maxNameLength);
|
||||
c->GetValueFatalIfFail("fs.accessLogging", &FLAGS_access_logging);
|
||||
{ // kernel cache option
|
||||
{ // kernel cache option
|
||||
auto o = &option->kernelCacheOption;
|
||||
c->GetValueFatalIfFail("fs.kernelCache.attrTimeoutSec",
|
||||
&o->attrTimeoutSec);
|
||||
c->GetValueFatalIfFail("fs.kernelCache.dirAttrTimeoutSec",
|
||||
&o->dirAttrTimeoutSec);
|
||||
c->GetValueFatalIfFail("fs.kernelCache.entryTimeoutSec",
|
||||
&o->entryTimeoutSec);
|
||||
c->GetValueFatalIfFail("fs.kernelCache.dirEntryTimeoutSec",
|
||||
&o->dirEntryTimeoutSec);
|
||||
c->GetValueFatalIfFail("fs.kernelCache.attrTimeout", &o->attrTimeout);
|
||||
c->GetValueFatalIfFail("fs.kernelCache.dirAttrTimeout", &o->dirAttrTimeout);
|
||||
c->GetValueFatalIfFail("fs.kernelCache.entryTimeout", &o->entryTimeout);
|
||||
c->GetValueFatalIfFail("fs.kernelCache.dirEntryTimeout", &o->dirEntryTimeout);
|
||||
}
|
||||
{ // lookup cache option
|
||||
{ // memory lookup cache option
|
||||
auto o = &option->lookupCacheOption;
|
||||
c->GetValueFatalIfFail("fs.lookupCache.lruSize",
|
||||
&o->lruSize);
|
||||
c->GetValueFatalIfFail("fs.lookupCache.negativeTimeoutSec",
|
||||
&o->negativeTimeoutSec);
|
||||
c->GetValueFatalIfFail("fs.lookupCache.minUses",
|
||||
&o->minUses);
|
||||
c->GetValueFatalIfFail("fs.lookupCache.lruSize", &o->lruSize);
|
||||
c->GetValueFatalIfFail("fs.lookupCache.negativeTimeout",
|
||||
&o->negativeTimeout);
|
||||
}
|
||||
{ // dir cache option
|
||||
{ // dir cache option
|
||||
auto o = &option->dirCacheOption;
|
||||
c->GetValueFatalIfFail("fs.dirCache.lruSize", &o->lruSize);
|
||||
}
|
||||
{ // open file option
|
||||
auto o = &option->openFilesOption;
|
||||
{ // open file option
|
||||
auto o = &option->openFileOption;
|
||||
c->GetValueFatalIfFail("fs.openFile.lruSize", &o->lruSize);
|
||||
}
|
||||
{ // attr watcher option
|
||||
{ // attr watcher option
|
||||
auto o = &option->attrWatcherOption;
|
||||
c->GetValueFatalIfFail("fs.attrWatcher.lruSize", &o->lruSize);
|
||||
}
|
||||
{ // rpc option
|
||||
{ // rpc option
|
||||
auto o = &option->rpcOption;
|
||||
c->GetValueFatalIfFail("fs.rpc.listDentryLimit", &o->listDentryLimit);
|
||||
}
|
||||
{ // defer sync option
|
||||
{ // defer sync option
|
||||
auto o = &option->deferSyncOption;
|
||||
c->GetValueFatalIfFail("fs.deferSync.delay", &o->delay);
|
||||
c->GetValueFatalIfFail("fs.deferSync.deferDirMtime", &o->deferDirMtime);
|
||||
|
|
@ -381,33 +325,6 @@ void InitFuseClientOption(Configuration *conf, FuseClientOption *clientOption) {
|
|||
<< "Not found `fuseClient.enableSplice` in conf, use default value `"
|
||||
<< std::boolalpha << clientOption->enableFuseSplice << '`';
|
||||
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.avgWriteBytes",
|
||||
&FLAGS_fuseClientAvgWriteBytes);
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.burstWriteBytes",
|
||||
&FLAGS_fuseClientBurstWriteBytes);
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.burstWriteBytesSecs",
|
||||
&FLAGS_fuseClientBurstWriteBytesSecs);
|
||||
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.avgWriteIops",
|
||||
&FLAGS_fuseClientAvgWriteIops);
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.burstWriteIops",
|
||||
&FLAGS_fuseClientBurstWriteIops);
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.burstWriteIopsSecs",
|
||||
&FLAGS_fuseClientBurstWriteIopsSecs);
|
||||
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.avgReadBytes",
|
||||
&FLAGS_fuseClientAvgReadBytes);
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.burstReadBytes",
|
||||
&FLAGS_fuseClientBurstReadBytes);
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.burstReadBytesSecs",
|
||||
&FLAGS_fuseClientBurstReadBytesSecs);
|
||||
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.avgReadIops",
|
||||
&FLAGS_fuseClientAvgReadIops);
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.burstReadIops",
|
||||
&FLAGS_fuseClientBurstReadIops);
|
||||
conf->GetValueFatalIfFail("fuseClient.throttle.burstReadIopsSecs",
|
||||
&FLAGS_fuseClientBurstReadIopsSecs);
|
||||
SetBrpcOpt(conf);
|
||||
}
|
||||
|
||||
|
|
@ -415,7 +332,6 @@ void SetFuseClientS3Option(FuseClientOption *clientOption,
|
|||
const S3InfoOption &fsS3Opt) {
|
||||
clientOption->s3Opt.s3ClientAdaptorOpt.blockSize = fsS3Opt.blockSize;
|
||||
clientOption->s3Opt.s3ClientAdaptorOpt.chunkSize = fsS3Opt.chunkSize;
|
||||
clientOption->s3Opt.s3ClientAdaptorOpt.objectPrefix = fsS3Opt.objectPrefix;
|
||||
clientOption->s3Opt.s3AdaptrOpt.s3Address = fsS3Opt.s3Address;
|
||||
clientOption->s3Opt.s3AdaptrOpt.ak = fsS3Opt.ak;
|
||||
clientOption->s3Opt.s3AdaptrOpt.sk = fsS3Opt.sk;
|
||||
|
|
@ -430,7 +346,6 @@ void S3Info2FsS3Option(const curvefs::common::S3Info& s3,
|
|||
fsS3Opt->bucketName = s3.bucketname();
|
||||
fsS3Opt->blockSize = s3.blocksize();
|
||||
fsS3Opt->chunkSize = s3.chunksize();
|
||||
fsS3Opt->objectPrefix = s3.has_objectprefix() ? s3.objectprefix() : 0;
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
|
|
|
|||
|
|
@ -32,13 +32,15 @@
|
|||
#include "src/common/configuration.h"
|
||||
#include "src/common/s3_adapter.h"
|
||||
|
||||
namespace curvefs {
|
||||
namespace client {
|
||||
namespace common {
|
||||
using ::curve::common::Configuration;
|
||||
using ::curve::common::S3AdapterOption;
|
||||
using ::curvefs::client::common::DiskCacheType;
|
||||
using ::curve::common::S3InfoOption;
|
||||
|
||||
namespace curvefs {
|
||||
namespace client {
|
||||
namespace common {
|
||||
|
||||
using MdsOption = ::curve::client::MetaServerOption;
|
||||
|
||||
struct BlockDeviceClientOptions {
|
||||
|
|
@ -104,7 +106,7 @@ struct DiskCacheOption {
|
|||
// the max time system command can run
|
||||
uint32_t cmdTimeoutSec;
|
||||
// threads for disk cache
|
||||
uint32_t threads = 10;
|
||||
uint32_t threads;
|
||||
// the write throttle bps of disk cache
|
||||
uint64_t avgFlushBytes;
|
||||
// the write burst bps of disk cache
|
||||
|
|
@ -122,6 +124,7 @@ struct DiskCacheOption {
|
|||
struct S3ClientAdaptorOption {
|
||||
uint64_t blockSize;
|
||||
uint64_t chunkSize;
|
||||
uint32_t fuseMaxSize;
|
||||
uint64_t pageSize;
|
||||
uint32_t prefetchBlocks;
|
||||
uint32_t prefetchExecQueueNum;
|
||||
|
|
@ -130,12 +133,10 @@ struct S3ClientAdaptorOption {
|
|||
uint32_t flushIntervalSec;
|
||||
uint64_t writeCacheMaxByte;
|
||||
uint64_t readCacheMaxByte;
|
||||
uint32_t readCacheThreads;
|
||||
uint32_t nearfullRatio;
|
||||
uint32_t baseSleepUs;
|
||||
uint32_t maxReadRetryIntervalMs;
|
||||
uint32_t readRetryIntervalMs;
|
||||
uint32_t objectPrefix;
|
||||
DiskCacheOption diskCacheOpt;
|
||||
};
|
||||
|
||||
|
|
@ -177,28 +178,27 @@ struct RefreshDataOption {
|
|||
|
||||
// { filesystem option
|
||||
struct KernelCacheOption {
|
||||
uint32_t entryTimeoutSec;
|
||||
uint32_t dirEntryTimeoutSec;
|
||||
uint32_t attrTimeoutSec;
|
||||
uint32_t dirAttrTimeoutSec;
|
||||
uint32_t entryTimeout;
|
||||
uint32_t dirEntryTimeout;
|
||||
uint32_t attrTimeout;
|
||||
uint32_t dirAttrTimeout;
|
||||
};
|
||||
|
||||
struct LookupCacheOption {
|
||||
uint64_t lruSize;
|
||||
uint32_t negativeTimeoutSec;
|
||||
uint32_t minUses;
|
||||
uint32_t negativeTimeout;
|
||||
};
|
||||
|
||||
struct DirCacheOption {
|
||||
uint64_t lruSize;
|
||||
uint32_t timeoutSec;
|
||||
uint32_t timeout;
|
||||
};
|
||||
|
||||
struct AttrWatcherOption {
|
||||
uint64_t lruSize;
|
||||
};
|
||||
|
||||
struct OpenFilesOption {
|
||||
struct OpenFileOption {
|
||||
uint64_t lruSize;
|
||||
uint32_t deferSyncSecond;
|
||||
};
|
||||
|
|
@ -220,7 +220,7 @@ struct FileSystemOption {
|
|||
KernelCacheOption kernelCacheOption;
|
||||
LookupCacheOption lookupCacheOption;
|
||||
DirCacheOption dirCacheOption;
|
||||
OpenFilesOption openFilesOption;
|
||||
OpenFileOption openFileOption;
|
||||
AttrWatcherOption attrWatcherOption;
|
||||
RPCOption rpcOption;
|
||||
DeferSyncOption deferSyncOption;
|
||||
|
|
@ -248,7 +248,7 @@ struct FuseClientOption {
|
|||
bool enableMultiMountPointRename = false;
|
||||
bool enableFuseSplice = false;
|
||||
uint32_t downloadMaxRetryTimes;
|
||||
uint32_t warmupThreadsNum = 10;
|
||||
uint32_t warmupThreadsNum;
|
||||
};
|
||||
|
||||
void InitFuseClientOption(Configuration *conf, FuseClientOption *clientOption);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ using ::curvefs::common::LatencyUpdater;
|
|||
using ::curvefs::client::metric::InflightGuard;
|
||||
using ::curvefs::client::filesystem::EntryOut;
|
||||
using ::curvefs::client::filesystem::AttrOut;
|
||||
using ::curvefs::client::filesystem::FileOut;
|
||||
using ::curvefs::client::filesystem::AccessLogGuard;
|
||||
using ::curvefs::client::filesystem::StrFormat;
|
||||
using ::curvefs::client::filesystem::InitAccessLog;
|
||||
|
|
@ -149,17 +148,18 @@ int InitLog(const char *confPath, const char *argv0) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int InitFuseClient(const struct MountOption *mountOption) {
|
||||
int InitFuseClient(const char *confPath, const char* fsName,
|
||||
const char *fsType, const char *mdsAddr) {
|
||||
g_clientOpMetric = new ClientOpMetric();
|
||||
|
||||
Configuration conf;
|
||||
conf.SetConfigPath(mountOption->conf);
|
||||
conf.SetConfigPath(confPath);
|
||||
if (!conf.LoadConfig()) {
|
||||
LOG(ERROR) << "LoadConfig failed, confPath = " << mountOption->conf;
|
||||
LOG(ERROR) << "LoadConfig failed, confPath = " << confPath;
|
||||
return -1;
|
||||
}
|
||||
if (mountOption->mdsAddr)
|
||||
conf.SetStringValue("mdsOpt.rpcRetryOpt.addrs", mountOption->mdsAddr);
|
||||
if (mdsAddr)
|
||||
conf.SetStringValue("mdsOpt.rpcRetryOpt.addrs", mdsAddr);
|
||||
|
||||
conf.PrintConfig();
|
||||
|
||||
|
|
@ -167,12 +167,11 @@ int InitFuseClient(const struct MountOption *mountOption) {
|
|||
curvefs::client::common::InitFuseClientOption(&conf, g_fuseClientOption);
|
||||
|
||||
std::shared_ptr<FsInfo> fsInfo = std::make_shared<FsInfo>();
|
||||
if (GetFsInfo(mountOption->fsName, fsInfo.get()) != 0) {
|
||||
if (GetFsInfo(fsName, fsInfo.get()) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string fsTypeStr =
|
||||
(mountOption->fsType == nullptr) ? "" : mountOption->fsType;
|
||||
std::string fsTypeStr = (fsType == nullptr) ? "" : fsType;
|
||||
std::string fsTypeMds;
|
||||
if (fsInfo->fstype() == FSType::TYPE_S3) {
|
||||
fsTypeMds = "s3";
|
||||
|
|
@ -202,11 +201,6 @@ int InitFuseClient(const struct MountOption *mountOption) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
ret = g_ClientInstance->SetMountStatus(mountOption);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -221,16 +215,15 @@ void UnInitFuseClient() {
|
|||
}
|
||||
|
||||
int AddWarmupTask(curvefs::client::common::WarmupType type, fuse_ino_t key,
|
||||
const std::string &path,
|
||||
curvefs::client::common::WarmupStorageType storageType) {
|
||||
const std::string &path) {
|
||||
int ret = 0;
|
||||
bool result = true;
|
||||
switch (type) {
|
||||
case curvefs::client::common::WarmupType::kWarmupTypeList:
|
||||
result = g_ClientInstance->PutWarmFilelistTask(key, storageType);
|
||||
result = g_ClientInstance->PutWarmFilelistTask(key);
|
||||
break;
|
||||
case curvefs::client::common::WarmupType::kWarmupTypeSingle:
|
||||
result = g_ClientInstance->PutWarmFileTask(key, path, storageType);
|
||||
result = g_ClientInstance->PutWarmFileTask(key, path);
|
||||
break;
|
||||
default:
|
||||
// not support add warmup type (warmup single file/dir or filelist)
|
||||
|
|
@ -264,23 +257,16 @@ int Warmup(fuse_ino_t key, const std::string& name, const std::string& value) {
|
|||
|
||||
std::vector<std::string> opTypePath;
|
||||
curve::common::SplitString(value, "\n", &opTypePath);
|
||||
if (opTypePath.size() != curvefs::client::common::kWarmupOpNum) {
|
||||
if (opTypePath.size() != 3) {
|
||||
LOG(ERROR) << name << " has invalid xattr value " << value;
|
||||
return ERANGE;
|
||||
}
|
||||
auto storageType =
|
||||
curvefs::client::common::GetWarmupStorageType(opTypePath[3]);
|
||||
if (storageType ==
|
||||
curvefs::client::common::WarmupStorageType::kWarmupStorageTypeUnknown) {
|
||||
LOG(ERROR) << name << " not support storage type: " << value;
|
||||
return ERANGE;
|
||||
}
|
||||
int ret = 0;
|
||||
switch (curvefs::client::common::GetWarmupOpType(opTypePath[0])) {
|
||||
case curvefs::client::common::WarmupOpType::kWarmupOpAdd:
|
||||
ret =
|
||||
AddWarmupTask(curvefs::client::common::GetWarmupType(opTypePath[1]),
|
||||
key, opTypePath[2], storageType);
|
||||
key, opTypePath[2]);
|
||||
if (ret != 0) {
|
||||
LOG(ERROR) << name << " has invalid xattr value " << value;
|
||||
}
|
||||
|
|
@ -294,27 +280,13 @@ int Warmup(fuse_ino_t key, const std::string& name, const std::string& value) {
|
|||
|
||||
namespace {
|
||||
|
||||
struct CodeGuard {
|
||||
explicit CodeGuard(CURVEFS_ERROR* rc, bvar::Adder<uint64_t>* ecount)
|
||||
: rc_(rc), ecount_(ecount) {}
|
||||
|
||||
~CodeGuard() {
|
||||
if (*rc_ != CURVEFS_ERROR::OK) {
|
||||
(*ecount_) << 1;
|
||||
}
|
||||
}
|
||||
|
||||
CURVEFS_ERROR* rc_;
|
||||
bvar::Adder<uint64_t>* ecount_;
|
||||
};
|
||||
|
||||
FuseClient* Client() {
|
||||
return g_ClientInstance;
|
||||
}
|
||||
|
||||
const char* warmupXAttr = ::curvefs::client::common::kCurveFsWarmupXAttr;
|
||||
|
||||
bool IsWamupReq(const char* name) {
|
||||
bool IsSpecialReq(const char* name) {
|
||||
return strcmp(name, warmupXAttr) == 0;
|
||||
}
|
||||
|
||||
|
|
@ -341,12 +313,8 @@ void QueryWarmup(fuse_req_t req, fuse_ino_t ino, size_t size) {
|
|||
return fs->ReplyBuffer(req, data.data(), data.length());
|
||||
}
|
||||
|
||||
void ReadThrottleAdd(size_t size) { Client()->Add(true, size); }
|
||||
void WriteThrottleAdd(size_t size) { Client()->Add(false, size); }
|
||||
|
||||
#define MetricGuard(REQUEST) \
|
||||
InflightGuard iGuard(&g_clientOpMetric->op##REQUEST.inflightOpNum); \
|
||||
CodeGuard cGuard(&rc, &g_clientOpMetric->op##REQUEST.ecount); \
|
||||
InflightGuard guard(&g_clientOpMetric->op##REQUEST.inflightOpNum); \
|
||||
LatencyUpdater updater(&g_clientOpMetric->op##REQUEST.latency)
|
||||
|
||||
} // namespace
|
||||
|
|
@ -571,9 +539,8 @@ void FuseOpLink(fuse_req_t req,
|
|||
auto fs = client->GetFileSystem();
|
||||
MetricGuard(Link);
|
||||
AccessLogGuard log([&](){
|
||||
return StrFormat(
|
||||
"link (%d,%d,%s): %s%s",
|
||||
ino, newparent, newname, StrErr(rc), StrEntry(entryOut));
|
||||
return StrFormat("link (%d,%d,%s): %s%s",
|
||||
ino, newparent, newname, StrErr(rc), StrEntry(entryOut));
|
||||
});
|
||||
|
||||
rc = client->FuseOpLink(req, ino, newparent, newname, &entryOut);
|
||||
|
|
@ -585,7 +552,6 @@ void FuseOpLink(fuse_req_t req,
|
|||
|
||||
void FuseOpOpen(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi) {
|
||||
CURVEFS_ERROR rc;
|
||||
FileOut fileOut;
|
||||
auto client = Client();
|
||||
auto fs = client->GetFileSystem();
|
||||
MetricGuard(Open);
|
||||
|
|
@ -593,12 +559,12 @@ void FuseOpOpen(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi) {
|
|||
return StrFormat("open (%d): %s [fh:%d]", ino, StrErr(rc), fi->fh);
|
||||
});
|
||||
|
||||
rc = client->FuseOpOpen(req, ino, fi, &fileOut);
|
||||
rc = client->FuseOpOpen(req, ino, fi);
|
||||
if (rc != CURVEFS_ERROR::OK) {
|
||||
fs->ReplyError(req, rc);
|
||||
return;
|
||||
}
|
||||
return fs->ReplyOpen(req, &fileOut);
|
||||
return fs->ReplyOpen(req, fi);
|
||||
}
|
||||
|
||||
void FuseOpRead(fuse_req_t req,
|
||||
|
|
@ -617,7 +583,6 @@ void FuseOpRead(fuse_req_t req,
|
|||
ino, size, off, fi->fh, StrErr(rc), rSize);
|
||||
});
|
||||
|
||||
ReadThrottleAdd(size);
|
||||
rc = client->FuseOpRead(req, ino, size, off, fi, buffer.get(), &rSize);
|
||||
if (rc != CURVEFS_ERROR::OK) {
|
||||
return fs->ReplyError(req, rc);
|
||||
|
|
@ -634,21 +599,20 @@ void FuseOpWrite(fuse_req_t req,
|
|||
off_t off,
|
||||
struct fuse_file_info *fi) {
|
||||
CURVEFS_ERROR rc;
|
||||
FileOut fileOut;
|
||||
size_t wSize = 0;
|
||||
auto client = Client();
|
||||
auto fs = client->GetFileSystem();
|
||||
MetricGuard(Read);
|
||||
AccessLogGuard log([&](){
|
||||
return StrFormat("write (%d,%d,%d,%d): %s (%d)",
|
||||
ino, size, off, fi->fh, StrErr(rc), fileOut.nwritten);
|
||||
ino, size, off, fi->fh, StrErr(rc), wSize);
|
||||
});
|
||||
|
||||
WriteThrottleAdd(size);
|
||||
rc = client->FuseOpWrite(req, ino, buf, size, off, fi, &fileOut);
|
||||
rc = client->FuseOpWrite(req, ino, buf, size, off, fi, &wSize);
|
||||
if (rc != CURVEFS_ERROR::OK) {
|
||||
return fs->ReplyError(req, rc);
|
||||
}
|
||||
return fs->ReplyWrite(req, &fileOut);
|
||||
return fs->ReplyWrite(req, wSize);
|
||||
}
|
||||
|
||||
void FuseOpFlush(fuse_req_t req,
|
||||
|
|
@ -803,7 +767,7 @@ void FuseOpSetXattr(fuse_req_t req,
|
|||
ino, name, size, flags, StrErr(rc));
|
||||
});
|
||||
|
||||
if (IsWamupReq(name)) {
|
||||
if (IsSpecialReq(name)) {
|
||||
return TriggerWarmup(req, ino, name, value, size);
|
||||
}
|
||||
rc = client->FuseOpSetXattr(req, ino, name, value, size, flags);
|
||||
|
|
@ -824,7 +788,7 @@ void FuseOpGetXattr(fuse_req_t req,
|
|||
ino, name, size, StrErr(rc), value.size());
|
||||
});
|
||||
|
||||
if (IsWamupReq(name)) {
|
||||
if (IsSpecialReq(name)) {
|
||||
return QueryWarmup(req, ino, size);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ extern "C" {
|
|||
|
||||
int InitLog(const char *confPath, const char *argv0);
|
||||
|
||||
int InitFuseClient(const struct MountOption *mountOption);
|
||||
int InitFuseClient(const char *confPath, const char *fsName,
|
||||
const char* fsType, const char* mdsAddr);
|
||||
|
||||
void UnInitFuseClient();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,14 +20,9 @@
|
|||
* Author: Jingli Chen (Wine93)
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <butil/time.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <spdlog/sinks/basic_file_sink.h>
|
||||
#include <spdlog/sinks/daily_file_sink.h>
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "curvefs/src/client/common/config.h"
|
||||
|
|
@ -51,14 +46,13 @@ using MessageHandler = std::function<std::string()>;
|
|||
static std::shared_ptr<spdlog::logger> Logger;
|
||||
|
||||
bool InitAccessLog(const std::string& prefix) {
|
||||
std::string filename = StrFormat("%s/access.%d.log", prefix, getpid());
|
||||
Logger = spdlog::daily_logger_mt("fuse_access", filename, 0, 0);
|
||||
Logger = spdlog::basic_logger_mt("fuse_access", prefix + "/access.log");
|
||||
spdlog::flush_every(std::chrono::seconds(1));
|
||||
return true;
|
||||
}
|
||||
|
||||
struct AccessLogGuard {
|
||||
explicit AccessLogGuard(MessageHandler handler)
|
||||
AccessLogGuard(MessageHandler handler)
|
||||
: enable(FLAGS_access_logging),
|
||||
handler(handler) {
|
||||
if (!enable) {
|
||||
|
|
|
|||
|
|
@ -59,26 +59,10 @@ void AttrWatcher::UpdateDirEntryAttr(Ino ino, const InodeAttr& attr) {
|
|||
}
|
||||
}
|
||||
|
||||
void AttrWatcher::UpdateDirEntryLength(Ino ino, const InodeAttr& open) {
|
||||
std::shared_ptr<DirEntryList> entries;
|
||||
for (const auto parent : open.parent()) {
|
||||
bool yes = dirCache_->Get(parent, &entries);
|
||||
if (!yes) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entries->UpdateLength(ino, open);
|
||||
|
||||
VLOG(1) << "Write back file length to dir entry cache: ino = " << ino
|
||||
<< ", attr = " << open.ShortDebugString();
|
||||
}
|
||||
}
|
||||
|
||||
AttrWatcherGuard::AttrWatcherGuard(std::shared_ptr<AttrWatcher> watcher,
|
||||
InodeAttr* attr,
|
||||
ReplyType type,
|
||||
bool writeBack)
|
||||
: watcher(watcher), attr(attr), type(type), writeBack(writeBack) {
|
||||
: watcher(watcher), attr(attr), writeBack(writeBack) {
|
||||
InodeAttr open;
|
||||
Ino ino = attr->inodeid();
|
||||
bool yes = watcher->openFiles_->GetFileAttr(ino, &open);
|
||||
|
|
@ -96,19 +80,9 @@ AttrWatcherGuard::AttrWatcherGuard(std::shared_ptr<AttrWatcher> watcher,
|
|||
}
|
||||
|
||||
AttrWatcherGuard::~AttrWatcherGuard() {
|
||||
switch (type) {
|
||||
case ReplyType::ATTR:
|
||||
watcher->RemeberMtime(*attr);
|
||||
if (writeBack) {
|
||||
watcher->UpdateDirEntryAttr(attr->inodeid(), *attr);
|
||||
}
|
||||
break;
|
||||
|
||||
case ReplyType::ONLY_LENGTH:
|
||||
if (writeBack) {
|
||||
watcher->UpdateDirEntryLength(attr->inodeid(), *attr);
|
||||
}
|
||||
break;
|
||||
watcher->RemeberMtime(*attr);
|
||||
if (writeBack) {
|
||||
watcher->UpdateDirEntryAttr(attr->inodeid(), *attr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_ATTR_WATCHER_H_
|
||||
#define CURVEFS_SRC_CLIENT_FILESYSTEM_ATTR_WATCHER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/common/lru_cache.h"
|
||||
#include "curvefs/src/client/common/config.h"
|
||||
#include "curvefs/src/client/filesystem/meta.h"
|
||||
|
|
@ -55,8 +53,6 @@ class AttrWatcher {
|
|||
|
||||
void UpdateDirEntryAttr(Ino ino, const InodeAttr& attr);
|
||||
|
||||
void UpdateDirEntryLength(Ino ino, const InodeAttr& open);
|
||||
|
||||
private:
|
||||
friend class AttrWatcherGuard;
|
||||
|
||||
|
|
@ -67,26 +63,18 @@ class AttrWatcher {
|
|||
std::shared_ptr<DirCache> dirCache_;
|
||||
};
|
||||
|
||||
|
||||
enum class ReplyType {
|
||||
ATTR,
|
||||
ONLY_LENGTH
|
||||
};
|
||||
|
||||
/*
|
||||
* each attribute reply to kernel, the watcher will:
|
||||
* before reply:
|
||||
* 1) set attibute length if the corresponding file is opened
|
||||
* after reply:
|
||||
* 1) remeber attribute modified time.
|
||||
* 2) write back attribute to dir entry cache if |writeBack| is true,
|
||||
* because the dir-entry attribute maybe stale.
|
||||
* before reply:
|
||||
* 1) set attibute length if the corresponding file is opened
|
||||
* after reply:
|
||||
* 1) remeber attribute modified time
|
||||
* 2) write back attribute to dir entry cache if |writeBack| it true
|
||||
*/
|
||||
struct AttrWatcherGuard {
|
||||
public:
|
||||
AttrWatcherGuard(std::shared_ptr<AttrWatcher> watcher,
|
||||
InodeAttr* attr,
|
||||
ReplyType type,
|
||||
bool writeBack);
|
||||
|
||||
~AttrWatcherGuard();
|
||||
|
|
@ -94,7 +82,6 @@ struct AttrWatcherGuard {
|
|||
private:
|
||||
std::shared_ptr<AttrWatcher> watcher;
|
||||
InodeAttr* attr;
|
||||
ReplyType type;
|
||||
bool writeBack;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@
|
|||
* Author: Jingli Chen (Wine93)
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "curvefs/src/client/filesystem/defer_sync.h"
|
||||
#include "curvefs/src/client/filesystem/utils.h"
|
||||
|
||||
|
|
@ -65,7 +62,7 @@ void DeferSync::SyncTask() {
|
|||
inodes.swap(inodes_);
|
||||
}
|
||||
for (const auto& inode : inodes) {
|
||||
UniqueLock lk(inode->GetUniqueLock());
|
||||
UniqueLock lck(inode->GetUniqueLock());
|
||||
inode->Async(nullptr, true);
|
||||
}
|
||||
inodes.clear();
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
#define CURVEFS_SRC_CLIENT_FILESYSTEM_DEFER_SYNC_H_
|
||||
|
||||
#include <atomic>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
#include "src/common/interruptible_sleeper.h"
|
||||
#include "curvefs/src/client/common/config.h"
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@
|
|||
* Author: Jingli Chen (Wine93)
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "curvefs/src/client/filesystem/dir_cache.h"
|
||||
#include "curvefs/src/client/filesystem/utils.h"
|
||||
|
||||
|
|
@ -119,7 +117,7 @@ DirCache::DirCache(DirCacheOption option)
|
|||
entries->Clear();
|
||||
});
|
||||
|
||||
LOG(INFO) << "Using directory lru cache, capacity = " << option_.lruSize;
|
||||
LOG(INFO) << "Using directory cache, capacity = " << option_.lruSize;
|
||||
}
|
||||
|
||||
void DirCache::Start() {
|
||||
|
|
@ -136,14 +134,14 @@ void DirCache::Delete(Ino parent,
|
|||
std::shared_ptr<DirEntryList> entries,
|
||||
bool evit) {
|
||||
nentries_ -= entries->Size();
|
||||
mq_->Publish(entries); // clear entries in background
|
||||
mq_->Publish(entries);
|
||||
lru_->Remove(parent);
|
||||
|
||||
VLOG(1) << "Delete directory cache (evit=" << evit << "): "
|
||||
<< "parent = " << parent
|
||||
<< ", mtime = " << entries->GetMtime()
|
||||
<< ", size = " << entries->Size()
|
||||
<< ", nentries = " << nentries_;
|
||||
LOG(INFO) << "Delete directory cache (evit=" << evit << "): "
|
||||
<< "parent = " << parent
|
||||
<< ", mtime = " << entries->GetMtime()
|
||||
<< ", size = " << entries->Size()
|
||||
<< ", nentries = " << nentries_;
|
||||
}
|
||||
|
||||
void DirCache::Evit(size_t size) {
|
||||
|
|
@ -160,14 +158,14 @@ void DirCache::Evit(size_t size) {
|
|||
|
||||
void DirCache::Put(Ino parent, std::shared_ptr<DirEntryList> entries) {
|
||||
WriteLockGuard lk(rwlock_);
|
||||
Evit(entries->Size()); // it guarantee put entries success
|
||||
Evit(entries->Size());
|
||||
lru_->Put(parent, entries);
|
||||
nentries_ += entries->Size();
|
||||
|
||||
VLOG(1) << "Insert directory cache: parent = " << parent
|
||||
<< ", mtime = " << entries->GetMtime()
|
||||
<< ", size = " << entries->Size()
|
||||
<< ", nentries = " << nentries_;
|
||||
LOG(INFO) << "Insert directory cache: parent = " << parent
|
||||
<< ", mtime = " << entries->GetMtime()
|
||||
<< ", size = " << entries->Size()
|
||||
<< ", nentries = " << nentries_;
|
||||
}
|
||||
|
||||
bool DirCache::Get(Ino parent, std::shared_ptr<DirEntryList>* entries) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "src/common/lru_cache.h"
|
||||
#include "src/common/concurrent/concurrent.h"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <ostream>
|
||||
|
||||
#include "curvefs/src/client/filesystem/error.h"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "curvefs/proto/metaserver.pb.h"
|
||||
|
|
@ -54,9 +53,8 @@ enum class CURVEFS_ERROR {
|
|||
OUT_OF_RANGE = -15,
|
||||
NODATA = -16,
|
||||
IO_ERROR = -17,
|
||||
CACHETOOSMALL = -18,
|
||||
STALE = -19,
|
||||
NOSYS = -20,
|
||||
STALE = -18,
|
||||
NOSYS = -19,
|
||||
};
|
||||
|
||||
std::string StrErr(CURVEFS_ERROR code);
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ FileSystem::FileSystem(FileSystemOption option, ExternalMember member)
|
|||
deferSync_ = std::make_shared<DeferSync>(option.deferSyncOption);
|
||||
negative_ = std::make_shared<LookupCache>(option.lookupCacheOption);
|
||||
dirCache_ = std::make_shared<DirCache>(option.dirCacheOption);
|
||||
openFiles_ = std::make_shared<OpenFiles>(option_.openFilesOption,
|
||||
deferSync_);
|
||||
openFiles_ = std::make_shared<OpenFiles>(option_.openFileOption,
|
||||
deferSync_, dirCache_);
|
||||
attrWatcher_ = std::make_shared<AttrWatcher>(option_.attrWatcherOption,
|
||||
openFiles_, dirCache_);
|
||||
handlerManager_ = std::make_shared<HandlerManager>();
|
||||
|
|
@ -55,22 +55,22 @@ void FileSystem::Destory() {
|
|||
|
||||
void FileSystem::Attr2Stat(InodeAttr* attr, struct stat* stat) {
|
||||
std::memset(stat, 0, sizeof(struct stat));
|
||||
stat->st_ino = attr->inodeid(); // inode number
|
||||
stat->st_mode = attr->mode(); // permission mode
|
||||
stat->st_nlink = attr->nlink(); // number of links
|
||||
stat->st_uid = attr->uid(); // user ID of owner
|
||||
stat->st_gid = attr->gid(); // group ID of owner
|
||||
stat->st_size = attr->length(); // total size, in bytes
|
||||
stat->st_rdev = attr->rdev(); // device ID (if special file)
|
||||
stat->st_atim.tv_sec = attr->atime(); // time of last access
|
||||
stat->st_ino = attr->inodeid();
|
||||
stat->st_mode = attr->mode();
|
||||
stat->st_nlink = attr->nlink();
|
||||
stat->st_uid = attr->uid();
|
||||
stat->st_gid = attr->gid();
|
||||
stat->st_size = attr->length();
|
||||
stat->st_rdev = attr->rdev();
|
||||
stat->st_atim.tv_sec = attr->atime(); // atime
|
||||
stat->st_atim.tv_nsec = attr->atime_ns();
|
||||
stat->st_mtim.tv_sec = attr->mtime(); // time of last modification
|
||||
stat->st_mtim.tv_sec = attr->mtime();
|
||||
stat->st_mtim.tv_nsec = attr->mtime_ns();
|
||||
stat->st_ctim.tv_sec = attr->ctime(); // time of last status change
|
||||
stat->st_ctim.tv_sec = attr->ctime();
|
||||
stat->st_ctim.tv_nsec = attr->ctime_ns();
|
||||
stat->st_blksize = option_.blockSize; // blocksize for file system I/O
|
||||
stat->st_blocks = 0; // number of 512B blocks allocated
|
||||
if (IsS3File(*attr)) {
|
||||
stat->st_blksize = option_.blockSize;;
|
||||
stat->st_blocks = 0;
|
||||
if (IsS3File(*attr) || IsDir(*attr)) {
|
||||
stat->st_blocks = (attr->length() + 511) / 512;
|
||||
}
|
||||
}
|
||||
|
|
@ -88,20 +88,20 @@ void FileSystem::Entry2Param(EntryOut* entryOut,
|
|||
void FileSystem::SetEntryTimeout(EntryOut* entryOut) {
|
||||
auto option = option_.kernelCacheOption;
|
||||
if (IsDir(entryOut->attr)) {
|
||||
entryOut->entryTimeout = option.dirEntryTimeoutSec;
|
||||
entryOut->attrTimeout = option.dirAttrTimeoutSec;
|
||||
entryOut->entryTimeout = option.dirEntryTimeout;
|
||||
entryOut->attrTimeout = option.dirAttrTimeout;
|
||||
} else {
|
||||
entryOut->entryTimeout = option.entryTimeoutSec;
|
||||
entryOut->attrTimeout = option.attrTimeoutSec;
|
||||
entryOut->entryTimeout = option.entryTimeout;
|
||||
entryOut->attrTimeout = option.attrTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystem::SetAttrTimeout(AttrOut* attrOut) {
|
||||
auto option = option_.kernelCacheOption;
|
||||
if (IsDir(attrOut->attr)) {
|
||||
attrOut->attrTimeout = option.dirAttrTimeoutSec;
|
||||
attrOut->attrTimeout = option.dirAttrTimeout;
|
||||
} else {
|
||||
attrOut->attrTimeout = option.attrTimeoutSec;
|
||||
attrOut->attrTimeout = option.attrTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -112,8 +112,7 @@ void FileSystem::ReplyError(Request req, CURVEFS_ERROR code) {
|
|||
|
||||
void FileSystem::ReplyEntry(Request req,
|
||||
EntryOut* entryOut) {
|
||||
AttrWatcherGuard watcher(attrWatcher_, &entryOut->attr,
|
||||
ReplyType::ATTR, true);
|
||||
AttrWatcherGuard watcher(attrWatcher_, &entryOut->attr, true);
|
||||
fuse_entry_param e;
|
||||
SetEntryTimeout(entryOut);
|
||||
Entry2Param(entryOut, &e);
|
||||
|
|
@ -122,8 +121,7 @@ void FileSystem::ReplyEntry(Request req,
|
|||
|
||||
void FileSystem::ReplyAttr(Request req,
|
||||
AttrOut* attrOut) {
|
||||
AttrWatcherGuard watcher(attrWatcher_, &attrOut->attr,
|
||||
ReplyType::ATTR, true);
|
||||
AttrWatcherGuard watcher(attrWatcher_, &attrOut->attr, true);
|
||||
struct stat stat;
|
||||
SetAttrTimeout(attrOut);
|
||||
Attr2Stat(&attrOut->attr, &stat);
|
||||
|
|
@ -134,26 +132,18 @@ void FileSystem::ReplyReadlink(Request req, const std::string& link) {
|
|||
fuse_reply_readlink(req, link.c_str());
|
||||
}
|
||||
|
||||
void FileSystem::ReplyOpen(Request req, FileInfo* fi) {
|
||||
void FileSystem::ReplyOpen(Request req, FileInfo *fi) {
|
||||
fuse_reply_open(req, fi);
|
||||
}
|
||||
|
||||
void FileSystem::ReplyOpen(Request req, FileOut* fileOut) {
|
||||
AttrWatcherGuard watcher(attrWatcher_, &fileOut->attr,
|
||||
ReplyType::ONLY_LENGTH, true);
|
||||
fuse_reply_open(req, fileOut->fi);
|
||||
}
|
||||
|
||||
void FileSystem::ReplyData(Request req,
|
||||
struct fuse_bufvec *bufv,
|
||||
enum fuse_buf_copy_flags flags) {
|
||||
enum fuse_buf_copy_flags flags) {
|
||||
fuse_reply_data(req, bufv, flags);
|
||||
}
|
||||
|
||||
void FileSystem::ReplyWrite(Request req, FileOut* fileOut) {
|
||||
AttrWatcherGuard watcher(attrWatcher_, &fileOut->attr,
|
||||
ReplyType::ONLY_LENGTH, true);
|
||||
fuse_reply_write(req, fileOut->nwritten);
|
||||
void FileSystem::ReplyWrite(Request req, size_t count) {
|
||||
fuse_reply_write(req, count);
|
||||
}
|
||||
|
||||
void FileSystem::ReplyBuffer(Request req, const char *buf, size_t size) {
|
||||
|
|
@ -169,8 +159,7 @@ void FileSystem::ReplyXattr(Request req, size_t size) {
|
|||
}
|
||||
|
||||
void FileSystem::ReplyCreate(Request req, EntryOut* entryOut, FileInfo* fi) {
|
||||
AttrWatcherGuard watcher(attrWatcher_, &entryOut->attr,
|
||||
ReplyType::ATTR, true);
|
||||
AttrWatcherGuard watcher(attrWatcher_, &entryOut->attr, true);
|
||||
fuse_entry_param e;
|
||||
SetEntryTimeout(entryOut);
|
||||
Entry2Param(entryOut, &e);
|
||||
|
|
@ -198,8 +187,7 @@ void FileSystem::AddDirEntry(Request req,
|
|||
void FileSystem::AddDirEntryPlus(Request req,
|
||||
DirBufferHead* buffer,
|
||||
DirEntry* dirEntry) {
|
||||
AttrWatcherGuard watcher(attrWatcher_, &dirEntry->attr,
|
||||
ReplyType::ATTR, false);
|
||||
AttrWatcherGuard watcher(attrWatcher_, &dirEntry->attr, false);
|
||||
struct fuse_entry_param e;
|
||||
EntryOut entryOut(dirEntry->attr);
|
||||
SetEntryTimeout(&entryOut);
|
||||
|
|
@ -230,7 +218,7 @@ void FileSystem::ReleaseHandler(uint64_t fh) {
|
|||
}
|
||||
|
||||
FileSystemMember FileSystem::BorrowMember() {
|
||||
return FileSystemMember(deferSync_, openFiles_, attrWatcher_);
|
||||
return FileSystemMember(deferSync_, openFiles_);
|
||||
}
|
||||
|
||||
// fuse request*
|
||||
|
|
@ -248,9 +236,7 @@ CURVEFS_ERROR FileSystem::Lookup(Request req,
|
|||
}
|
||||
|
||||
auto rc = rpc_->Lookup(parent, name, entryOut);
|
||||
if (rc == CURVEFS_ERROR::OK) {
|
||||
negative_->Delete(parent, name);
|
||||
} else if (rc == CURVEFS_ERROR::NOTEXIST) {
|
||||
if (rc == CURVEFS_ERROR::NOTEXIST) {
|
||||
negative_->Put(parent, name);
|
||||
}
|
||||
return rc;
|
||||
|
|
@ -332,7 +318,7 @@ CURVEFS_ERROR FileSystem::Open(Request req, Ino ino, FileInfo* fi) {
|
|||
LOG(WARNING) << "open(" << ino << "): stale file handler"
|
||||
<< ": attribute not found in wacther";
|
||||
return CURVEFS_ERROR::STALE;
|
||||
} else if (mtime != InodeMtime(inode)) {
|
||||
} else if(mtime != InodeMtime(inode)) {
|
||||
LOG(WARNING) << "open(" << ino << "): stale file handler"
|
||||
<< ", cache(" << mtime << ") vs remote("
|
||||
<< InodeMtime(inode) << ")";
|
||||
|
|
|
|||
|
|
@ -23,11 +23,6 @@
|
|||
#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_FILESYSTEM_H_
|
||||
#define CURVEFS_SRC_CLIENT_FILESYSTEM_FILESYSTEM_H_
|
||||
|
||||
#include <gtest/gtest_prod.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "curvefs/src/client/filesystem/error.h"
|
||||
#include "curvefs/src/client/common/config.h"
|
||||
#include "curvefs/src/client/filesystem/package.h"
|
||||
|
|
@ -47,15 +42,12 @@ using ::curvefs::client::common::FileSystemOption;
|
|||
|
||||
struct FileSystemMember {
|
||||
FileSystemMember(std::shared_ptr<DeferSync> deferSync,
|
||||
std::shared_ptr<OpenFiles> openFiles,
|
||||
std::shared_ptr<AttrWatcher> attrWatcher)
|
||||
std::shared_ptr<OpenFiles> openFiles)
|
||||
: deferSync(deferSync),
|
||||
openFiles(openFiles),
|
||||
attrWatcher(attrWatcher) {}
|
||||
openFiles(openFiles) {}
|
||||
|
||||
std::shared_ptr<DeferSync> deferSync;
|
||||
std::shared_ptr<OpenFiles> openFiles;
|
||||
std::shared_ptr<AttrWatcher> attrWatcher;
|
||||
};
|
||||
|
||||
class FileSystem {
|
||||
|
|
@ -98,13 +90,11 @@ class FileSystem {
|
|||
|
||||
void ReplyOpen(Request req, FileInfo *fi);
|
||||
|
||||
void ReplyOpen(Request req, FileOut* fileOut);
|
||||
|
||||
void ReplyData(Request req,
|
||||
struct fuse_bufvec *bufv,
|
||||
enum fuse_buf_copy_flags flags);
|
||||
enum fuse_buf_copy_flags flags);
|
||||
|
||||
void ReplyWrite(Request req, FileOut* fileOut);
|
||||
void ReplyWrite(Request req, size_t count);
|
||||
|
||||
void ReplyBuffer(Request req, const char *buf, size_t size);
|
||||
|
||||
|
|
@ -133,11 +123,6 @@ class FileSystem {
|
|||
FileSystemMember BorrowMember();
|
||||
|
||||
private:
|
||||
FRIEND_TEST(FileSystemTest, Attr2Stat);
|
||||
FRIEND_TEST(FileSystemTest, Entry2Param);
|
||||
FRIEND_TEST(FileSystemTest, SetEntryTimeout);
|
||||
FRIEND_TEST(FileSystemTest, SetAttrTimeout);
|
||||
|
||||
// utility: convert to system type.
|
||||
void Attr2Stat(InodeAttr* attr, struct stat* stat);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,71 +32,43 @@ namespace curvefs {
|
|||
namespace client {
|
||||
namespace filesystem {
|
||||
|
||||
#define RETURN_FALSE_IF_DISABLED() \
|
||||
do { \
|
||||
if (!enable_) { \
|
||||
return false; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
LookupCache::LookupCache(LookupCacheOption option)
|
||||
: enable_(option.negativeTimeoutSec > 0),
|
||||
: enable_(option.negativeTimeout > 0),
|
||||
rwlock_(),
|
||||
option_(option) {
|
||||
lru_ = std::make_shared<LRUType>(option.lruSize);
|
||||
if (enable_) {
|
||||
LOG(INFO) << "Using lookup negative lru cache"
|
||||
<< ", timeout = " << option.negativeTimeoutSec
|
||||
<< ", capacity = " << option.lruSize;
|
||||
}
|
||||
}
|
||||
|
||||
std::string LookupCache::CacheKey(Ino parent, const std::string& name) {
|
||||
std::string LookupCache::Entry2Key(Ino parent, const std::string& name) {
|
||||
return absl::StrFormat("%d:%s", parent, name);
|
||||
}
|
||||
|
||||
bool LookupCache::Get(Ino parent, const std::string& name) {
|
||||
RETURN_FALSE_IF_DISABLED();
|
||||
if (!enable_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ReadLockGuard lk(rwlock_);
|
||||
CacheEntry entry;
|
||||
auto key = CacheKey(parent, name);
|
||||
bool yes = lru_->Get(key, &entry);
|
||||
std::string key = Entry2Key(parent, name);
|
||||
TimeSpec expireTime;
|
||||
bool yes = lru_->Get(key, &expireTime);
|
||||
if (!yes) {
|
||||
VLOG(1) << absl::StrFormat("Lookup cache not found: key(%d,%s)",
|
||||
parent, name);
|
||||
return false;
|
||||
} else if (entry.uses < option_.minUses) {
|
||||
return false;
|
||||
} else if (entry.expireTime < Now()) {
|
||||
} else if (Now() > expireTime) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LookupCache::Put(Ino parent, const std::string& name) {
|
||||
RETURN_FALSE_IF_DISABLED();
|
||||
WriteLockGuard lk(rwlock_);
|
||||
CacheEntry entry;
|
||||
auto key = CacheKey(parent, name);
|
||||
bool yes = lru_->Get(key, &entry);
|
||||
if (yes) {
|
||||
entry.uses++;
|
||||
} else {
|
||||
entry.uses = 0;
|
||||
void LookupCache::Put(Ino parent, const std::string& name) {
|
||||
if (!enable_) {
|
||||
return;
|
||||
}
|
||||
|
||||
entry.expireTime = Now() + TimeSpec(option_.negativeTimeoutSec, 0);
|
||||
lru_->Put(key, entry);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LookupCache::Delete(Ino parent, const std::string& name) {
|
||||
RETURN_FALSE_IF_DISABLED();
|
||||
WriteLockGuard lk(rwlock_);
|
||||
auto key = CacheKey(parent, name);
|
||||
lru_->Remove(key);
|
||||
return true;
|
||||
auto key = Entry2Key(parent, name);
|
||||
TimeSpec expireTime = Now() + TimeSpec(option_.negativeTimeout, 0);
|
||||
lru_->Put(key, expireTime);
|
||||
}
|
||||
|
||||
} // namespace filesystem
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_LOOKUP_CACHE_H_
|
||||
#define CURVEFS_SRC_CLIENT_FILESYSTEM_LOOKUP_CACHE_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "src/common/lru_cache.h"
|
||||
#include "curvefs/src/client/common/config.h"
|
||||
#include "curvefs/src/client/filesystem/meta.h"
|
||||
|
|
@ -41,27 +38,20 @@ using ::curve::common::WriteLockGuard;
|
|||
using ::curvefs::client::common::LookupCacheOption;
|
||||
|
||||
// memory cache for lookup result, now we only support cache negative result,
|
||||
// and other positive entry will be cached in kernel.
|
||||
// other positive entry will be cached in kernel.
|
||||
class LookupCache {
|
||||
public:
|
||||
struct CacheEntry {
|
||||
uint32_t uses;
|
||||
TimeSpec expireTime;
|
||||
};
|
||||
|
||||
using LRUType = LRUCache<std::string, CacheEntry>;
|
||||
using LRUType = LRUCache<std::string, TimeSpec>;
|
||||
|
||||
public:
|
||||
explicit LookupCache(LookupCacheOption option);
|
||||
|
||||
bool Get(Ino parent, const std::string& name);
|
||||
|
||||
bool Put(Ino parent, const std::string& name);
|
||||
|
||||
bool Delete(Ino parent, const std::string& name);
|
||||
void Put(Ino parent, const std::string& name);
|
||||
|
||||
private:
|
||||
std::string CacheKey(Ino parent, const std::string& name);
|
||||
std::string Entry2Key(Ino parent, const std::string& name);
|
||||
|
||||
private:
|
||||
bool enable_;
|
||||
|
|
|
|||
|
|
@ -97,10 +97,6 @@ class MessageQueue {
|
|||
while (running_.load(std::memory_order_relaxed)) {
|
||||
queue_.Pop()();
|
||||
}
|
||||
|
||||
while (queue_.Size() > 0) {
|
||||
queue_.Pop()();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -65,37 +65,37 @@ void HandlerManager::ReleaseHandler(uint64_t fh) {
|
|||
|
||||
std::string StrMode(uint16_t mode) {
|
||||
static std::map<uint16_t, char> type2char = {
|
||||
{ S_IFSOCK, 's' },
|
||||
{ S_IFLNK, 'l' },
|
||||
{ S_IFREG, '-' },
|
||||
{ S_IFBLK, 'b' },
|
||||
{ S_IFDIR, 'd' },
|
||||
{ S_IFCHR, 'c' },
|
||||
{ S_IFIFO, 'f' },
|
||||
{ 0, '?' },
|
||||
{ S_IFSOCK, 's' },
|
||||
{ S_IFLNK, 'l' },
|
||||
{ S_IFREG, '-' },
|
||||
{ S_IFBLK, 'b' },
|
||||
{ S_IFDIR, 'd' },
|
||||
{ S_IFCHR, 'c' },
|
||||
{ S_IFIFO, 'f' },
|
||||
{ 0, '?' },
|
||||
};
|
||||
|
||||
std::string s("?rwxrwxrwx");
|
||||
s[0] = type2char[mode & (S_IFMT & 0xffff)];
|
||||
if (mode & S_ISUID) {
|
||||
s[3] = 's';
|
||||
}
|
||||
if (mode & S_ISGID) {
|
||||
s[6] = 's';
|
||||
}
|
||||
if (mode & S_ISVTX) {
|
||||
s[9] = 't';
|
||||
}
|
||||
s[0] = type2char[mode & (S_IFMT & 0xffff)];
|
||||
if (mode & S_ISUID) {
|
||||
s[3] = 's';
|
||||
}
|
||||
if (mode & S_ISGID) {
|
||||
s[6] = 's';
|
||||
}
|
||||
if (mode & S_ISVTX) {
|
||||
s[9] = 't';
|
||||
}
|
||||
|
||||
for (auto i = 0; i < 9; i++) {
|
||||
if ((mode & (1 << i)) == 0) {
|
||||
if ((s[9-i] == 's') || (s[9-i] == 't')) {
|
||||
s[9-i] &= 0xDF;
|
||||
} else {
|
||||
s[9-i] = '-';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((mode & (1 << i)) == 0) {
|
||||
if ((s[9-i] == 's') || (s[9-i] == 't')) {
|
||||
s[9-i] &= 0xDF;
|
||||
} else {
|
||||
s[9-i] = '-';
|
||||
}
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_META_H_
|
||||
#define CURVEFS_SRC_CLIENT_FILESYSTEM_META_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "src/common/concurrent/concurrent.h"
|
||||
|
|
@ -57,7 +54,7 @@ using FileInfo = struct fuse_file_info;
|
|||
struct EntryOut {
|
||||
EntryOut() = default;
|
||||
|
||||
explicit EntryOut(InodeAttr attr) : attr(attr) {}
|
||||
EntryOut(InodeAttr attr) : attr(attr) {}
|
||||
|
||||
InodeAttr attr;
|
||||
double entryTimeout;
|
||||
|
|
@ -67,7 +64,7 @@ struct EntryOut {
|
|||
struct AttrOut {
|
||||
AttrOut() = default;
|
||||
|
||||
explicit AttrOut(InodeAttr attr) : attr(attr) {}
|
||||
AttrOut(InodeAttr attr) : attr(attr) {}
|
||||
|
||||
InodeAttr attr;
|
||||
double attrTimeout;
|
||||
|
|
@ -84,20 +81,6 @@ struct DirEntry {
|
|||
InodeAttr attr;
|
||||
};
|
||||
|
||||
struct FileOut {
|
||||
FileOut() = default;
|
||||
|
||||
FileOut(FileInfo* fi, InodeAttr attr)
|
||||
: fi(fi), attr(attr), nwritten(0) {}
|
||||
|
||||
FileOut(InodeAttr attr, size_t nwritten)
|
||||
: fi(nullptr), attr(attr), nwritten(nwritten) {}
|
||||
|
||||
FileInfo* fi;
|
||||
InodeAttr attr;
|
||||
size_t nwritten;
|
||||
};
|
||||
|
||||
struct TimeSpec {
|
||||
TimeSpec() : seconds(0), nanoSeconds(0) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,23 +27,46 @@ namespace curvefs {
|
|||
namespace client {
|
||||
namespace filesystem {
|
||||
|
||||
OpenFiles::OpenFiles(OpenFilesOption option,
|
||||
std::shared_ptr<DeferSync> deferSync)
|
||||
OpenFiles::OpenFiles(OpenFileOption option,
|
||||
std::shared_ptr<DeferSync> deferSync,
|
||||
std::shared_ptr<DirCache> dirCache)
|
||||
: rwlock_(),
|
||||
option_(option),
|
||||
deferSync_(deferSync),
|
||||
dirCache_(dirCache),
|
||||
files_(std::make_shared<LRUType>(option.lruSize)) {
|
||||
LOG(INFO) << "Using openfile lru cache, capacity " << option.lruSize;
|
||||
}
|
||||
|
||||
void OpenFiles::UpdateDirEntryLength(Ino ino,
|
||||
const std::shared_ptr<OpenFile>& file) {
|
||||
InodeAttr attr;
|
||||
std::shared_ptr<DirEntryList> entries;
|
||||
file->inode->GetInodeAttr(&attr);
|
||||
for (const auto parent : attr.parent()) {
|
||||
bool yes = dirCache_->Get(parent, &entries);
|
||||
if (!yes) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entries->UpdateLength(ino, attr);
|
||||
|
||||
VLOG(1) << "Write back file length to dir entry cache: ino = " << ino
|
||||
<< ", length = " << attr.length()
|
||||
<< ", mtime = " << AttrMtime(attr)
|
||||
<< ", ctime = " << AttrCtime(attr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete(...) does:
|
||||
* 1) publish to message queue which will flush file to server with async
|
||||
* 2) delete file from lru cache
|
||||
* 1) write back file length to dir entry cache
|
||||
* 2) publish to message queue which will flush file to server with async
|
||||
* 3) delete file from lru cache
|
||||
*/
|
||||
void OpenFiles::Delete(Ino ino,
|
||||
const std::shared_ptr<OpenFile>& file,
|
||||
bool flush) {
|
||||
UpdateDirEntryLength(ino, file); // write back file length to dir cache
|
||||
if (flush) {
|
||||
deferSync_->Push(file->inode);
|
||||
}
|
||||
|
|
@ -117,7 +140,8 @@ void OpenFiles::Close(Ino ino) {
|
|||
|
||||
/*
|
||||
* CloseAll() does:
|
||||
* flush all file to server and delete from LRU cache
|
||||
* 1) flush all file to server and delete from LRU cache
|
||||
* 2) stop message queue
|
||||
*/
|
||||
void OpenFiles::CloseAll() {
|
||||
WriteLockGuard lk(rwlock_);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_OPENFILE_H_
|
||||
#define CURVEFS_SRC_CLIENT_FILESYSTEM_OPENFILE_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/common/lru_cache.h"
|
||||
#include "curvefs/src/client/inode_wrapper.h"
|
||||
#include "curvefs/src/client/filesystem/meta.h"
|
||||
|
|
@ -39,10 +37,10 @@ using ::curve::common::LRUCache;
|
|||
using ::curve::common::ReadLockGuard;
|
||||
using ::curve::common::WriteLockGuard;
|
||||
using ::curvefs::client::InodeWrapper;
|
||||
using ::curvefs::client::common::OpenFilesOption;
|
||||
using ::curvefs::client::common::OpenFileOption;
|
||||
|
||||
struct OpenFile {
|
||||
explicit OpenFile(std::shared_ptr<InodeWrapper> inode)
|
||||
OpenFile(std::shared_ptr<InodeWrapper> inode)
|
||||
: inode(inode), refs(0) {}
|
||||
|
||||
std::shared_ptr<InodeWrapper> inode;
|
||||
|
|
@ -54,8 +52,9 @@ class OpenFiles {
|
|||
using LRUType = LRUCache<Ino, std::shared_ptr<OpenFile>>;
|
||||
|
||||
public:
|
||||
explicit OpenFiles(OpenFilesOption option,
|
||||
std::shared_ptr<DeferSync> deferSync);
|
||||
explicit OpenFiles(OpenFileOption option,
|
||||
std::shared_ptr<DeferSync> deferSync,
|
||||
std::shared_ptr<DirCache> dirCache);
|
||||
|
||||
void Open(Ino ino, std::shared_ptr<InodeWrapper> inode);
|
||||
|
||||
|
|
@ -68,14 +67,18 @@ class OpenFiles {
|
|||
bool GetFileAttr(Ino ino, InodeAttr* inode);
|
||||
|
||||
private:
|
||||
void UpdateDirEntryLength(Ino ino,
|
||||
const std::shared_ptr<OpenFile>& file);
|
||||
|
||||
void Delete(Ino ino, const std::shared_ptr<OpenFile>& file, bool flush);
|
||||
|
||||
void Evit(size_t size);
|
||||
|
||||
private:
|
||||
RWLock rwlock_;
|
||||
OpenFilesOption option_;
|
||||
OpenFileOption option_;
|
||||
std::shared_ptr<DeferSync> deferSync_;
|
||||
std::shared_ptr<DirCache> dirCache_;
|
||||
std::shared_ptr<LRUType> files_;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_PACKAGE_H_
|
||||
#define CURVEFS_SRC_CLIENT_FILESYSTEM_PACKAGE_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "curvefs/src/client/dentry_cache_manager.h"
|
||||
#include "curvefs/src/client/inode_cache_manager.h"
|
||||
#include "curvefs/src/client/xattr_manager.h"
|
||||
|
|
@ -34,14 +32,16 @@ namespace client {
|
|||
namespace filesystem {
|
||||
|
||||
struct ExternalMember { // external member depended by FileSystem
|
||||
ExternalMember() = delete;
|
||||
ExternalMember(std::shared_ptr<DentryCacheManager> dentryManager,
|
||||
std::shared_ptr<InodeCacheManager> inodeManager)
|
||||
: dentryManager(dentryManager),
|
||||
inodeManager(inodeManager) {}
|
||||
ExternalMember(std::shared_ptr<InodeCacheManager> inodeManager,
|
||||
std::shared_ptr<DentryCacheManager> dentryManager,
|
||||
std::shared_ptr<XattrManager> xattrManager)
|
||||
: inodeManager(inodeManager),
|
||||
dentryManager(dentryManager),
|
||||
xattrManager(xattrManager) {}
|
||||
|
||||
std::shared_ptr<DentryCacheManager> dentryManager;
|
||||
std::shared_ptr<InodeCacheManager> inodeManager;
|
||||
std::shared_ptr<DentryCacheManager> dentryManager;
|
||||
std::shared_ptr<XattrManager> xattrManager;
|
||||
};
|
||||
|
||||
} // namespace filesystem
|
||||
|
|
|
|||
|
|
@ -22,10 +22,6 @@
|
|||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "curvefs/src/client/filesystem/rpc_client.h"
|
||||
|
||||
|
|
@ -55,8 +51,8 @@ CURVEFS_ERROR RPCClient::Lookup(Ino parent,
|
|||
CURVEFS_ERROR rc = dentryManager_->GetDentry(parent, name, &dentry);
|
||||
if (rc != CURVEFS_ERROR::OK) {
|
||||
if (rc != CURVEFS_ERROR::NOTEXIST) {
|
||||
LOG(ERROR) << "rpc(lookup::GetDentry) failed, retCode = " << rc
|
||||
<< ", parent = " << parent << ", name = " << name;
|
||||
LOG(WARNING) << "rpc(lookup::GetDentry) failed, retCode = " << rc
|
||||
<< ", parent = " << parent << ", name = " << name;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -70,8 +66,7 @@ CURVEFS_ERROR RPCClient::Lookup(Ino parent,
|
|||
return rc;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR RPCClient::ReadDir(Ino ino,
|
||||
std::shared_ptr<DirEntryList>* entries) {
|
||||
CURVEFS_ERROR RPCClient::ReadDir(Ino ino, std::shared_ptr<DirEntryList>* entries) {
|
||||
uint32_t limit = option_.listDentryLimit;
|
||||
|
||||
std::list<Dentry> dentries;
|
||||
|
|
@ -104,11 +99,9 @@ CURVEFS_ERROR RPCClient::ReadDir(Ino ino,
|
|||
continue;
|
||||
}
|
||||
|
||||
// NOTE: we can't use std::move() for attribute for hard link
|
||||
// which will sharing inode attribute.
|
||||
dirEntry.ino = ino;
|
||||
dirEntry.name = std::move(dentry.name());
|
||||
dirEntry.attr = iter->second;
|
||||
dirEntry.attr = std::move(iter->second);
|
||||
(*entries)->Add(dirEntry);
|
||||
}
|
||||
return CURVEFS_ERROR::OK;
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_RPC_CLIENT_H_
|
||||
#define CURVEFS_SRC_CLIENT_FILESYSTEM_RPC_CLIENT_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "curvefs/src/client/common/config.h"
|
||||
#include "curvefs/src/client/filesystem/meta.h"
|
||||
#include "curvefs/src/client/filesystem/package.h"
|
||||
|
|
@ -62,4 +59,4 @@ class RPCClient {
|
|||
} // namespace client
|
||||
} // namespace curvefs
|
||||
|
||||
#endif // CURVEFS_SRC_CLIENT_FILESYSTEM_RPC_CLIENT_H_
|
||||
#endif // CURVEFS_SRC_CLIENT_FILESYSTEM_RPC_CLIENT_H_
|
||||
|
|
@ -23,8 +23,6 @@
|
|||
#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_UTILS_H_
|
||||
#define CURVEFS_SRC_CLIENT_FILESYSTEM_UTILS_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "curvefs/src/client/filesystem/meta.h"
|
||||
#include "curvefs/src/client/filesystem/package.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ using ::curvefs::client::common::MAX_XATTR_VALUE_LENGTH;
|
|||
using ::curvefs::client::filesystem::ExternalMember;
|
||||
using ::curvefs::client::filesystem::DirEntry;
|
||||
using ::curvefs::client::filesystem::DirEntryList;
|
||||
using ::curvefs::client::filesystem::FileOut;
|
||||
|
||||
#define RETURN_IF_UNSUCCESS(action) \
|
||||
do { \
|
||||
|
|
@ -73,21 +72,6 @@ namespace curvefs {
|
|||
namespace client {
|
||||
namespace common {
|
||||
DECLARE_bool(enableCto);
|
||||
DECLARE_uint64(fuseClientAvgWriteIops);
|
||||
DECLARE_uint64(fuseClientBurstWriteIops);
|
||||
DECLARE_uint64(fuseClientBurstWriteIopsSecs);
|
||||
|
||||
DECLARE_uint64(fuseClientAvgWriteBytes);
|
||||
DECLARE_uint64(fuseClientBurstWriteBytes);
|
||||
DECLARE_uint64(fuseClientBurstWriteBytesSecs);
|
||||
|
||||
DECLARE_uint64(fuseClientAvgReadIops);
|
||||
DECLARE_uint64(fuseClientBurstReadIops);
|
||||
DECLARE_uint64(fuseClientBurstReadIopsSecs);
|
||||
|
||||
DECLARE_uint64(fuseClientAvgReadBytes);
|
||||
DECLARE_uint64(fuseClientBurstReadBytes);
|
||||
DECLARE_uint64(fuseClientBurstReadBytesSecs);
|
||||
} // namespace common
|
||||
} // namespace client
|
||||
} // namespace curvefs
|
||||
|
|
@ -101,27 +85,6 @@ using rpcclient::Cli2ClientImpl;
|
|||
using rpcclient::MetaCache;
|
||||
using common::FLAGS_enableCto;
|
||||
|
||||
using common::FLAGS_fuseClientAvgWriteIops;
|
||||
using common::FLAGS_fuseClientBurstWriteIops;
|
||||
using common::FLAGS_fuseClientBurstWriteIopsSecs;
|
||||
|
||||
using common::FLAGS_fuseClientAvgWriteBytes;
|
||||
using common::FLAGS_fuseClientBurstWriteBytes;
|
||||
using common::FLAGS_fuseClientBurstWriteBytesSecs;
|
||||
|
||||
using common::FLAGS_fuseClientAvgReadIops;
|
||||
using common::FLAGS_fuseClientBurstReadIops;
|
||||
using common::FLAGS_fuseClientBurstReadIopsSecs;
|
||||
|
||||
using common::FLAGS_fuseClientAvgReadBytes;
|
||||
using common::FLAGS_fuseClientBurstReadBytes;
|
||||
using common::FLAGS_fuseClientBurstReadBytesSecs;
|
||||
|
||||
static void on_throttle_timer(void *arg) {
|
||||
FuseClient *fuseClient = reinterpret_cast<FuseClient *>(arg);
|
||||
fuseClient->InitQosParam();
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::Init(const FuseClientOption &option) {
|
||||
option_ = option;
|
||||
|
||||
|
|
@ -137,8 +100,7 @@ CURVEFS_ERROR FuseClient::Init(const FuseClientOption &option) {
|
|||
auto channelManager = std::make_shared<ChannelManager<MetaserverID>>();
|
||||
|
||||
leaseExecutor_ = absl::make_unique<LeaseExecutor>(option.leaseOpt,
|
||||
metaCache, mdsClient_,
|
||||
&enableSumInDir_);
|
||||
metaCache, mdsClient_);
|
||||
|
||||
xattrManager_ = std::make_shared<XattrManager>(inodeManager_,
|
||||
dentryManager_, option_.listDentryLimit, option_.listDentryThreads);
|
||||
|
|
@ -158,7 +120,9 @@ CURVEFS_ERROR FuseClient::Init(const FuseClientOption &option) {
|
|||
curve::client::ClientDummyServerInfo::GetInstance().SetIP(localIp);
|
||||
|
||||
{
|
||||
ExternalMember member(dentryManager_, inodeManager_);
|
||||
ExternalMember member(inodeManager_,
|
||||
dentryManager_,
|
||||
xattrManager_);
|
||||
fs_ = std::make_shared<FileSystem>(option_.fileSystemOption, member);
|
||||
}
|
||||
|
||||
|
|
@ -184,8 +148,6 @@ CURVEFS_ERROR FuseClient::Init(const FuseClientOption &option) {
|
|||
warmupManager_->SetFsInfo(fsInfo_);
|
||||
}
|
||||
|
||||
InitQosParam();
|
||||
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
|
|
@ -196,10 +158,6 @@ void FuseClient::UnInit() {
|
|||
|
||||
delete mdsBase_;
|
||||
mdsBase_ = nullptr;
|
||||
|
||||
while (bthread_timer_del(throttleTimer_) == 1) {
|
||||
bthread_usleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::Run() {
|
||||
|
|
@ -217,9 +175,51 @@ void FuseClient::Fini() {
|
|||
|
||||
CURVEFS_ERROR FuseClient::FuseOpInit(void *userdata,
|
||||
struct fuse_conn_info *conn) {
|
||||
(void)userdata;
|
||||
(void)conn;
|
||||
struct MountOption* mOpts = (struct MountOption*)userdata;
|
||||
// set path
|
||||
mountpoint_.set_path((mOpts->mountPoint == nullptr) ? ""
|
||||
: mOpts->mountPoint);
|
||||
std::string fsName = (mOpts->fsName == nullptr) ? "" : mOpts->fsName;
|
||||
|
||||
mountpoint_.set_cto(false);
|
||||
|
||||
int retVal = SetHostPortInMountPoint(&mountpoint_);
|
||||
if (retVal < 0) {
|
||||
LOG(ERROR) << "Set Host and Port in MountPoint failed, ret = "
|
||||
<< retVal;
|
||||
return CURVEFS_ERROR::INTERNAL;
|
||||
}
|
||||
|
||||
auto ret = mdsClient_->MountFs(fsName, mountpoint_, fsInfo_.get());
|
||||
if (ret != FSStatusCode::OK && ret != FSStatusCode::MOUNT_POINT_EXIST) {
|
||||
LOG(ERROR) << "MountFs failed, FSStatusCode = " << ret
|
||||
<< ", FSStatusCode_Name = "
|
||||
<< FSStatusCode_Name(ret)
|
||||
<< ", fsName = " << fsName
|
||||
<< ", mountPoint = " << mountpoint_.ShortDebugString();
|
||||
return CURVEFS_ERROR::MOUNT_FAILED;
|
||||
}
|
||||
inodeManager_->SetFsId(fsInfo_->fsid());
|
||||
dentryManager_->SetFsId(fsInfo_->fsid());
|
||||
enableSumInDir_ = fsInfo_->enablesumindir() && !FLAGS_enableCto;
|
||||
LOG(INFO) << "Mount " << fsName << " on " << mountpoint_.ShortDebugString()
|
||||
<< " success!" << " enableSumInDir = " << enableSumInDir_;
|
||||
|
||||
fsMetric_ = std::make_shared<FSMetric>(fsName);
|
||||
|
||||
fs_->Run();
|
||||
|
||||
// init fsname and mountpoint
|
||||
leaseExecutor_->SetFsName(fsName);
|
||||
leaseExecutor_->SetMountPoint(mountpoint_);
|
||||
if (!leaseExecutor_->Start()) {
|
||||
return CURVEFS_ERROR::INTERNAL;
|
||||
}
|
||||
|
||||
init_ = true;
|
||||
if (warmupManager_ != nullptr) {
|
||||
warmupManager_->SetMounted(true);
|
||||
}
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
|
|
@ -275,8 +275,7 @@ CURVEFS_ERROR FuseClient::FuseOpLookup(fuse_req_t req,
|
|||
|
||||
CURVEFS_ERROR FuseClient::HandleOpenFlags(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct fuse_file_info* fi,
|
||||
FileOut* fileOut) {
|
||||
struct fuse_file_info* fi) {
|
||||
std::shared_ptr<InodeWrapper> inodeWrapper;
|
||||
// alredy opened
|
||||
CURVEFS_ERROR ret = inodeManager_->GetInode(ino, inodeWrapper);
|
||||
|
|
@ -285,14 +284,9 @@ CURVEFS_ERROR FuseClient::HandleOpenFlags(fuse_req_t req,
|
|||
<< ", inodeid = " << ino;
|
||||
return ret;
|
||||
}
|
||||
|
||||
fileOut->fi = fi;
|
||||
inodeWrapper->GetInodeAttr(&fileOut->attr);
|
||||
|
||||
::curve::common::UniqueLock lgGuard = inodeWrapper->GetUniqueLock();
|
||||
if (fi->flags & O_TRUNC) {
|
||||
if (fi->flags & O_WRONLY || fi->flags & O_RDWR) {
|
||||
::curve::common::UniqueLock lgGuard =
|
||||
inodeWrapper->GetUniqueLock();
|
||||
uint64_t length = inodeWrapper->GetLengthLocked();
|
||||
CURVEFS_ERROR tRet = Truncate(inodeWrapper.get(), 0);
|
||||
if (tRet != CURVEFS_ERROR::OK) {
|
||||
|
|
@ -311,7 +305,7 @@ CURVEFS_ERROR FuseClient::HandleOpenFlags(fuse_req_t req,
|
|||
inodeWrapper->MarkDirty();
|
||||
}
|
||||
|
||||
if (enableSumInDir_.load() && length != 0) {
|
||||
if (enableSumInDir_ && length != 0) {
|
||||
// update parent summary info
|
||||
const Inode *inode = inodeWrapper->GetInodeLocked();
|
||||
XAttr xattr;
|
||||
|
|
@ -327,7 +321,6 @@ CURVEFS_ERROR FuseClient::HandleOpenFlags(fuse_req_t req,
|
|||
}
|
||||
}
|
||||
}
|
||||
inodeWrapper->GetInodeAttrLocked(&fileOut->attr);
|
||||
} else {
|
||||
return CURVEFS_ERROR::NOPERMISSION;
|
||||
}
|
||||
|
|
@ -337,14 +330,13 @@ CURVEFS_ERROR FuseClient::HandleOpenFlags(fuse_req_t req,
|
|||
|
||||
CURVEFS_ERROR FuseClient::FuseOpOpen(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct fuse_file_info* fi,
|
||||
FileOut* fileOut) {
|
||||
struct fuse_file_info* fi) {
|
||||
CURVEFS_ERROR rc = fs_->Open(req, ino, fi);
|
||||
if (rc != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "open(" << ino << ") failed, retCode = " << rc;
|
||||
return rc;
|
||||
}
|
||||
return HandleOpenFlags(req, ino, fi, fileOut);
|
||||
return HandleOpenFlags(req, ino, fi);
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::UpdateParentMCTimeAndNlink(
|
||||
|
|
@ -369,38 +361,27 @@ CURVEFS_ERROR FuseClient::UpdateParentMCTimeAndNlink(
|
|||
if (option_.fileSystemOption.deferSyncOption.deferDirMtime) {
|
||||
inodeManager_->ShipToFlush(parentInodeWrapper);
|
||||
} else {
|
||||
return parentInodeWrapper->SyncAttr();
|
||||
ret = parentInodeWrapper->SyncAttr();
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::MakeNode(
|
||||
fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
const char* name,
|
||||
mode_t mode,
|
||||
FsFileType type,
|
||||
dev_t rdev,
|
||||
bool internal,
|
||||
std::shared_ptr<InodeWrapper>& inodeWrapper) {
|
||||
CURVEFS_ERROR FuseClient::MakeNode(fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
const char* name,
|
||||
mode_t mode,
|
||||
FsFileType type,
|
||||
dev_t rdev,
|
||||
bool internal,
|
||||
std::shared_ptr<InodeWrapper>& inodeWrapper) {
|
||||
if (strlen(name) > option_.fileSystemOption.maxNameLength) {
|
||||
return CURVEFS_ERROR::NAMETOOLONG;
|
||||
}
|
||||
|
||||
// check if node is recycle or under recycle
|
||||
if (!internal && strcmp(name, RECYCLENAME) == 0 && parent == ROOTINODEID) {
|
||||
LOG(WARNING) << "Can not make node " << RECYCLENAME
|
||||
<< " under root dir.";
|
||||
return CURVEFS_ERROR::NOPERMISSION;
|
||||
}
|
||||
|
||||
if (!internal && parent == RECYCLEINODEID) {
|
||||
LOG(WARNING) << "Can not make node under recycle.";
|
||||
return CURVEFS_ERROR::NOPERMISSION;
|
||||
}
|
||||
|
||||
const struct fuse_ctx *ctx = fuse_req_ctx(req);
|
||||
InodeParam param;
|
||||
param.fsId = fsInfo_->fsid();
|
||||
|
|
@ -467,7 +448,7 @@ CURVEFS_ERROR FuseClient::MakeNode(
|
|||
<< ", parent = " << parent << ", name = " << name
|
||||
<< ", mode = " << mode;
|
||||
|
||||
if (enableSumInDir_.load()) {
|
||||
if (enableSumInDir_) {
|
||||
// update parent summary info
|
||||
XAttr xattr;
|
||||
xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"});
|
||||
|
|
@ -514,9 +495,38 @@ CURVEFS_ERROR FuseClient::FuseOpRmDir(fuse_req_t req, fuse_ino_t parent,
|
|||
return RemoveNode(req, parent, name, FsFileType::TYPE_DIRECTORY);
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::DeleteNode(uint64_t ino, fuse_ino_t parent,
|
||||
const char* name, FsFileType type) {
|
||||
CURVEFS_ERROR ret = dentryManager_->DeleteDentry(parent, name, type);
|
||||
CURVEFS_ERROR FuseClient::RemoveNode(fuse_req_t req, fuse_ino_t parent,
|
||||
const char *name, FsFileType type) {
|
||||
if (strlen(name) > option_.fileSystemOption.maxNameLength) {
|
||||
return CURVEFS_ERROR::NAMETOOLONG;
|
||||
}
|
||||
Dentry dentry;
|
||||
CURVEFS_ERROR ret = dentryManager_->GetDentry(parent, name, &dentry);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(WARNING) << "dentryManager_ GetDentry fail, ret = " << ret
|
||||
<< ", parent = " << parent << ", name = " << name;
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t ino = dentry.inodeid();
|
||||
|
||||
// judge dir empty
|
||||
if (FsFileType::TYPE_DIRECTORY == type) {
|
||||
std::list<Dentry> dentryList;
|
||||
auto limit = option_.listDentryLimit;
|
||||
ret = dentryManager_->ListDentry(ino, &dentryList, limit);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "dentryManager_ ListDentry fail, ret = " << ret
|
||||
<< ", parent = " << ino;
|
||||
return ret;
|
||||
}
|
||||
if (!dentryList.empty()) {
|
||||
LOG(ERROR) << "rmdir not empty";
|
||||
return CURVEFS_ERROR::NOTEMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
ret = dentryManager_->DeleteDentry(parent, name, type);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "dentryManager_ DeleteDentry fail, ret = " << ret
|
||||
<< ", parent = " << parent << ", name = " << name;
|
||||
|
|
@ -546,7 +556,7 @@ CURVEFS_ERROR FuseClient::DeleteNode(uint64_t ino, fuse_ino_t parent,
|
|||
<< ", parent = " << parent << ", name = " << name;
|
||||
}
|
||||
|
||||
if (enableSumInDir_.load()) {
|
||||
if (enableSumInDir_) {
|
||||
// update parent summary info
|
||||
XAttr xattr;
|
||||
xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"});
|
||||
|
|
@ -567,272 +577,6 @@ CURVEFS_ERROR FuseClient::DeleteNode(uint64_t ino, fuse_ino_t parent,
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::string GetRecycleTimeDirName() {
|
||||
time_t timeStamp;
|
||||
time(&timeStamp);
|
||||
struct tm p = *localtime_r(&timeStamp, &p);
|
||||
char now[64];
|
||||
strftime(now, 64, "%Y-%m-%d-%H", &p);
|
||||
return now;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::CreateManageNode(fuse_req_t req,
|
||||
uint64_t parent,
|
||||
const char* name,
|
||||
mode_t mode,
|
||||
ManageInodeType manageType,
|
||||
EntryOut* entryOut) {
|
||||
if (strlen(name) > option_.fileSystemOption.maxNameLength) {
|
||||
return CURVEFS_ERROR::NAMETOOLONG;
|
||||
}
|
||||
|
||||
InodeParam param;
|
||||
param.fsId = fsInfo_->fsid();
|
||||
const struct fuse_ctx *ctx = fuse_req_ctx(req);
|
||||
param.uid = ctx->uid;
|
||||
param.gid = ctx->gid;
|
||||
param.mode = mode;
|
||||
param.manageType = manageType;
|
||||
|
||||
std::shared_ptr<InodeWrapper> inodeWrapper;
|
||||
CURVEFS_ERROR ret = inodeManager_->CreateManageInode(param, inodeWrapper);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "inodeManager CreateManageNode fail, ret = " << ret
|
||||
<< ", parent = " << parent << ", name = " << name
|
||||
<< ", mode = " << mode;
|
||||
return ret;
|
||||
}
|
||||
|
||||
VLOG(6) << "inodeManager CreateManageNode success"
|
||||
<< ", parent = " << parent << ", name = " << name
|
||||
<< ", mode = " << mode
|
||||
<< ", inode id = " << inodeWrapper->GetInodeId();
|
||||
|
||||
Dentry dentry;
|
||||
dentry.set_fsid(fsInfo_->fsid());
|
||||
dentry.set_inodeid(inodeWrapper->GetInodeId());
|
||||
dentry.set_parentinodeid(parent);
|
||||
dentry.set_name(name);
|
||||
dentry.set_type(inodeWrapper->GetType());
|
||||
FsFileType type = inodeWrapper->GetType();
|
||||
if (type == FsFileType::TYPE_FILE || type == FsFileType::TYPE_S3) {
|
||||
dentry.set_flag(DentryFlag::TYPE_FILE_FLAG);
|
||||
}
|
||||
|
||||
ret = dentryManager_->CreateDentry(dentry);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "dentryManager_ CreateDentry fail, ret = " << ret
|
||||
<< ", parent = " << parent << ", name = " << name
|
||||
<< ", mode = " << mode;
|
||||
|
||||
CURVEFS_ERROR ret2 =
|
||||
inodeManager_->DeleteInode(inodeWrapper->GetInodeId());
|
||||
if (ret2 != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "Also delete inode failed, ret = " << ret2
|
||||
<< ", inodeid = " << inodeWrapper->GetInodeId();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = UpdateParentMCTimeAndNlink(parent, type, NlinkChange::kAddOne);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "UpdateParentMCTimeAndNlink failed"
|
||||
<< ", parent: " << parent
|
||||
<< ", name: " << name
|
||||
<< ", type: " << type;
|
||||
return ret;
|
||||
}
|
||||
|
||||
VLOG(6) << "dentryManager_ CreateDentry success"
|
||||
<< ", parent = " << parent << ", name = " << name
|
||||
<< ", mode = " << mode;
|
||||
|
||||
if (enableSumInDir_.load()) {
|
||||
// update parent summary info
|
||||
XAttr xattr;
|
||||
xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"});
|
||||
if (type == FsFileType::TYPE_DIRECTORY) {
|
||||
xattr.mutable_xattrinfos()->insert({XATTRSUBDIRS, "1"});
|
||||
} else {
|
||||
xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"});
|
||||
}
|
||||
xattr.mutable_xattrinfos()->insert({XATTRFBYTES,
|
||||
std::to_string(inodeWrapper->GetLength())});
|
||||
auto tret = xattrManager_->UpdateParentInodeXattr(parent, xattr, true);
|
||||
if (tret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "UpdateParentInodeXattr failed,"
|
||||
<< " inodeId = " << parent
|
||||
<< ", xattr = " << xattr.DebugString();
|
||||
}
|
||||
}
|
||||
|
||||
inodeWrapper->GetInodeAttrLocked(&entryOut->attr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::GetOrCreateRecycleDir(fuse_req_t req, Dentry *out) {
|
||||
auto ret = dentryManager_->GetDentry(ROOTINODEID, RECYCLENAME, out);
|
||||
if (ret != CURVEFS_ERROR::OK && ret != CURVEFS_ERROR::NOTEXIST) {
|
||||
LOG(ERROR) << "dentryManager_ GetDentry fail, ret = " << ret
|
||||
<< ", inode = " << ROOTINODEID
|
||||
<< ", name = " << RECYCLENAME;
|
||||
return ret;
|
||||
} else if (ret == CURVEFS_ERROR::NOTEXIST) {
|
||||
LOG(INFO) << "recycle dir is not exist, create " << RECYCLENAME
|
||||
<< ", parentid = " << ROOTINODEID;
|
||||
EntryOut entryOut;
|
||||
ret = CreateManageNode(req, ROOTINODEID, RECYCLENAME,
|
||||
S_IFDIR | 0755, ManageInodeType::TYPE_RECYCLE,
|
||||
&entryOut);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "CreateManageNode failed, ret = " << ret
|
||||
<< ", inode = " << ROOTINODEID
|
||||
<< ", name = " << RECYCLENAME
|
||||
<< ", type = TYPE_RECYCLE";
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::MoveToRecycle(fuse_req_t req, fuse_ino_t ino,
|
||||
fuse_ino_t parent, const char* name, FsFileType type) {
|
||||
(void)type;
|
||||
// 1. check recycle exist, if not exist, create recycle dir
|
||||
Dentry recycleDir;
|
||||
CURVEFS_ERROR ret = GetOrCreateRecycleDir(req, &recycleDir);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "GetOrCreateRecycleDir fail, move " << name
|
||||
<< " to recycle fail, ret = " << ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 2. check recycle time dir is exist, if not exist, create time dir
|
||||
std::string recycleTimeDirName = GetRecycleTimeDirName();
|
||||
Dentry dentry;
|
||||
uint64_t recycleTimeDirIno;
|
||||
ret = dentryManager_->GetDentry(RECYCLEINODEID,
|
||||
recycleTimeDirName.c_str(), &dentry);
|
||||
if (ret != CURVEFS_ERROR::OK && ret != CURVEFS_ERROR::NOTEXIST) {
|
||||
LOG(ERROR) << "dentryManager_ GetDentry fail, ret = " << ret
|
||||
<< ", inode = " << RECYCLEINODEID
|
||||
<< ", name = " << recycleTimeDirName;
|
||||
return ret;
|
||||
} else if (ret == CURVEFS_ERROR::NOTEXIST) {
|
||||
std::shared_ptr<InodeWrapper> inode;
|
||||
bool internal = true;
|
||||
ret = MakeNode(req, RECYCLEINODEID, recycleTimeDirName.c_str(),
|
||||
S_IFDIR | 0755, FsFileType::TYPE_DIRECTORY, 0, internal, inode);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "MakeNode failed, ret = " << ret
|
||||
<< ", inode = " << RECYCLEINODEID
|
||||
<< ", name = " << recycleTimeDirName;
|
||||
return ret;
|
||||
}
|
||||
recycleTimeDirIno = inode->GetInodeId();
|
||||
} else {
|
||||
recycleTimeDirIno = dentry.inodeid();
|
||||
}
|
||||
|
||||
// 3. generate new name, parentid_inodeid_name
|
||||
std::string newName = GenerateNewRecycleName(ino, parent, name);
|
||||
|
||||
// 4. move inode to recycle time dir
|
||||
ret = FuseOpRename(req, parent, name,
|
||||
recycleTimeDirIno, newName.c_str(), 0);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "MoveToRecycle failed, ret = " << ret
|
||||
<< ", inodeid = " << ino
|
||||
<< ", parent = " << parent << ", name = " << name;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
bool FuseClient::ShouldMoveToRecycle(fuse_ino_t parent) {
|
||||
// 1. check if recycle is open, if recycle not open, return false
|
||||
if (!fsInfo_->has_recycletimehour() || fsInfo_->recycletimehour() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. check if inode is in recycle, if node in recycle, return false
|
||||
std::shared_ptr<InodeWrapper> inodeWrapper;
|
||||
CURVEFS_ERROR ret = inodeManager_->GetInode(parent, inodeWrapper);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "inodeManager get inode fail, ret = " << ret
|
||||
<< ", inodeid = " << parent;
|
||||
return false;
|
||||
}
|
||||
|
||||
InodeAttr attr;
|
||||
inodeWrapper->GetInodeAttrLocked(&attr);
|
||||
if (attr.parent_size() != 0 && attr.parent(0) == RECYCLEINODEID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::RemoveNode(fuse_req_t req, fuse_ino_t parent,
|
||||
const char *name, FsFileType type) {
|
||||
if (strlen(name) > option_.fileSystemOption.maxNameLength) {
|
||||
return CURVEFS_ERROR::NAMETOOLONG;
|
||||
}
|
||||
|
||||
// check if node is recycle or recycle time dir
|
||||
if ((strcmp(name, RECYCLENAME) == 0 && parent == ROOTINODEID) ||
|
||||
parent == RECYCLEINODEID) {
|
||||
return CURVEFS_ERROR::NOPERMISSION;
|
||||
}
|
||||
|
||||
Dentry dentry;
|
||||
CURVEFS_ERROR ret = dentryManager_->GetDentry(parent, name, &dentry);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(WARNING) << "dentryManager_ GetDentry fail, ret = " << ret
|
||||
<< ", parent = " << parent << ", name = " << name;
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t ino = dentry.inodeid();
|
||||
|
||||
// check dir empty
|
||||
if (FsFileType::TYPE_DIRECTORY == type) {
|
||||
std::list<Dentry> dentryList;
|
||||
auto limit = option_.listDentryLimit;
|
||||
ret = dentryManager_->ListDentry(ino, &dentryList, limit);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "dentryManager_ ListDentry fail, ret = " << ret
|
||||
<< ", parent = " << ino;
|
||||
return ret;
|
||||
}
|
||||
if (!dentryList.empty()) {
|
||||
LOG(ERROR) << "rmdir not empty";
|
||||
return CURVEFS_ERROR::NOTEMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
// check if inode should move to recycle
|
||||
if (ShouldMoveToRecycle(parent)) {
|
||||
ret = MoveToRecycle(req, ino, parent, name, type);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "MoveToRecycle failed, ret = " << ret
|
||||
<< ", inodeid = " << ino;
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
ret = DeleteNode(ino, parent, name, type);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
LOG(ERROR) << "DeleteNode failed, ret = " << ret
|
||||
<< ", inodeid = " << ino;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseClient::FuseOpOpenDir(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct fuse_file_info* fi) {
|
||||
|
|
@ -871,6 +615,7 @@ CURVEFS_ERROR FuseClient::FuseOpReadDir(fuse_req_t req,
|
|||
}
|
||||
});
|
||||
handler->padding = true;
|
||||
//LOG(INFO) << "<<< padding";
|
||||
}
|
||||
|
||||
if (off < buffer->size) {
|
||||
|
|
@ -941,10 +686,9 @@ CURVEFS_ERROR FuseClient::FuseOpRename(fuse_req_t req, fuse_ino_t parent,
|
|||
if (parent != newparent) {
|
||||
renameOp.UpdateInodeParent();
|
||||
}
|
||||
renameOp.UpdateInodeCtime();
|
||||
renameOp.UpdateCache();
|
||||
|
||||
if (enableSumInDir_.load()) {
|
||||
if (enableSumInDir_) {
|
||||
xattrManager_->UpdateParentXattrAfterRename(
|
||||
parent, newparent, newname, &renameOp);
|
||||
}
|
||||
|
|
@ -1028,7 +772,7 @@ CURVEFS_ERROR FuseClient::FuseOpSetAttr(fuse_req_t req,
|
|||
}
|
||||
inodeWrapper->GetInodeAttrLocked(&attrOut->attr);
|
||||
|
||||
if (enableSumInDir_.load() && changeSize != 0) {
|
||||
if (enableSumInDir_ && changeSize != 0) {
|
||||
// update parent summary info
|
||||
const Inode* inode = inodeWrapper->GetInodeLocked();
|
||||
XAttr xattr;
|
||||
|
|
@ -1058,7 +802,6 @@ CURVEFS_ERROR FuseClient::FuseOpSetAttr(fuse_req_t req,
|
|||
CURVEFS_ERROR FuseClient::FuseOpGetXattr(fuse_req_t req, fuse_ino_t ino,
|
||||
const char* name, std::string* value,
|
||||
size_t size) {
|
||||
(void)req;
|
||||
VLOG(9) << "FuseOpGetXattr, ino: " << ino
|
||||
<< ", name: " << name << ", size = " << size;
|
||||
if (option_.fileSystemOption.disableXattr) {
|
||||
|
|
@ -1073,8 +816,7 @@ CURVEFS_ERROR FuseClient::FuseOpGetXattr(fuse_req_t req, fuse_ino_t ino,
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = xattrManager_->GetXattr(name, value,
|
||||
&inodeAttr, enableSumInDir_.load());
|
||||
ret = xattrManager_->GetXattr(name, value, &inodeAttr, enableSumInDir_);
|
||||
if (CURVEFS_ERROR::OK != ret) {
|
||||
LOG(ERROR) << "xattrManager get xattr failed, name = " << name;
|
||||
return ret;
|
||||
|
|
@ -1134,7 +876,6 @@ CURVEFS_ERROR FuseClient::FuseOpSetXattr(fuse_req_t req, fuse_ino_t ino,
|
|||
|
||||
CURVEFS_ERROR FuseClient::FuseOpListXattr(fuse_req_t req, fuse_ino_t ino,
|
||||
char *value, size_t size, size_t *realSize) {
|
||||
(void)req;
|
||||
VLOG(1) << "FuseOpListXattr, ino: " << ino << ", size = " << size;
|
||||
InodeAttr inodeAttr;
|
||||
CURVEFS_ERROR ret = inodeManager_->GetInodeAttr(ino, &inodeAttr);
|
||||
|
|
@ -1240,7 +981,7 @@ CURVEFS_ERROR FuseClient::FuseOpSymlink(fuse_req_t req,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (enableSumInDir_.load()) {
|
||||
if (enableSumInDir_) {
|
||||
// update parent summary info
|
||||
XAttr xattr;
|
||||
xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"});
|
||||
|
|
@ -1310,7 +1051,7 @@ CURVEFS_ERROR FuseClient::FuseOpLink(fuse_req_t req,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (enableSumInDir_.load()) {
|
||||
if (enableSumInDir_) {
|
||||
// update parent summary info
|
||||
XAttr xattr;
|
||||
xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"});
|
||||
|
|
@ -1332,7 +1073,6 @@ CURVEFS_ERROR FuseClient::FuseOpLink(fuse_req_t req,
|
|||
|
||||
CURVEFS_ERROR FuseClient::FuseOpReadLink(fuse_req_t req, fuse_ino_t ino,
|
||||
std::string *linkStr) {
|
||||
(void)req;
|
||||
VLOG(1) << "FuseOpReadLink, ino: " << ino << ", linkStr: " << linkStr;
|
||||
InodeAttr attr;
|
||||
CURVEFS_ERROR ret = inodeManager_->GetInodeAttr(ino, &attr);
|
||||
|
|
@ -1359,84 +1099,5 @@ void FuseClient::FlushAll() {
|
|||
FlushData();
|
||||
}
|
||||
|
||||
CURVEFS_ERROR
|
||||
FuseClient::SetMountStatus(const struct MountOption *mountOption) {
|
||||
mountpoint_.set_path(
|
||||
(mountOption->mountPoint == nullptr) ? "" : mountOption->mountPoint);
|
||||
std::string fsName =
|
||||
(mountOption->fsName == nullptr) ? "" : mountOption->fsName;
|
||||
|
||||
mountpoint_.set_cto(FLAGS_enableCto);
|
||||
|
||||
int retVal = SetHostPortInMountPoint(&mountpoint_);
|
||||
if (retVal < 0) {
|
||||
LOG(ERROR) << "Set Host and Port in MountPoint failed, ret = "
|
||||
<< retVal;
|
||||
return CURVEFS_ERROR::INTERNAL;
|
||||
}
|
||||
|
||||
auto ret = mdsClient_->MountFs(fsName, mountpoint_, fsInfo_.get());
|
||||
if (ret != FSStatusCode::OK && ret != FSStatusCode::MOUNT_POINT_EXIST) {
|
||||
LOG(ERROR) << "MountFs failed, FSStatusCode = " << ret
|
||||
<< ", FSStatusCode_Name = " << FSStatusCode_Name(ret)
|
||||
<< ", fsName = " << fsName
|
||||
<< ", mountPoint = " << mountpoint_.ShortDebugString();
|
||||
return CURVEFS_ERROR::MOUNT_FAILED;
|
||||
}
|
||||
inodeManager_->SetFsId(fsInfo_->fsid());
|
||||
dentryManager_->SetFsId(fsInfo_->fsid());
|
||||
enableSumInDir_.store(fsInfo_->enablesumindir());
|
||||
if (fsInfo_->has_recycletimehour()) {
|
||||
enableSumInDir_.store(enableSumInDir_.load() &&
|
||||
(fsInfo_->recycletimehour() == 0));
|
||||
}
|
||||
|
||||
LOG(INFO) << "Mount " << fsName << " on " << mountpoint_.ShortDebugString()
|
||||
<< " success!"
|
||||
<< " enableSumInDir = " << enableSumInDir_.load();
|
||||
|
||||
fsMetric_ = std::make_shared<FSMetric>(fsName);
|
||||
|
||||
// init fsname and mountpoint
|
||||
leaseExecutor_->SetFsName(fsName);
|
||||
leaseExecutor_->SetMountPoint(mountpoint_);
|
||||
if (!leaseExecutor_->Start()) {
|
||||
return CURVEFS_ERROR::INTERNAL;
|
||||
}
|
||||
|
||||
init_ = true;
|
||||
if (warmupManager_ != nullptr) {
|
||||
warmupManager_->SetMounted(true);
|
||||
}
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
void FuseClient::InitQosParam() {
|
||||
ReadWriteThrottleParams params;
|
||||
params.iopsWrite = ThrottleParams(FLAGS_fuseClientAvgWriteIops,
|
||||
FLAGS_fuseClientBurstWriteIops,
|
||||
FLAGS_fuseClientBurstWriteIopsSecs);
|
||||
|
||||
params.bpsWrite = ThrottleParams(FLAGS_fuseClientAvgWriteBytes,
|
||||
FLAGS_fuseClientBurstWriteBytes,
|
||||
FLAGS_fuseClientBurstWriteBytesSecs);
|
||||
|
||||
params.iopsRead = ThrottleParams(FLAGS_fuseClientAvgReadIops,
|
||||
FLAGS_fuseClientBurstReadIops,
|
||||
FLAGS_fuseClientBurstReadIopsSecs);
|
||||
|
||||
params.bpsRead = ThrottleParams(FLAGS_fuseClientAvgReadBytes,
|
||||
FLAGS_fuseClientBurstReadBytes,
|
||||
FLAGS_fuseClientBurstReadBytesSecs);
|
||||
|
||||
throttle_.UpdateThrottleParams(params);
|
||||
|
||||
int ret = bthread_timer_add(&throttleTimer_, butil::seconds_from_now(1),
|
||||
on_throttle_timer, this);
|
||||
if (ret != 0) {
|
||||
LOG(ERROR) << "Create fuse client throttle timer failed!";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace client
|
||||
} // namespace curvefs
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <bthread/unstable.h>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
|
@ -33,7 +32,6 @@
|
|||
#include <list>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
|
||||
#include "curvefs/proto/common.pb.h"
|
||||
#include "curvefs/proto/mds.pb.h"
|
||||
|
|
@ -55,7 +53,6 @@
|
|||
#include "curvefs/src/client/lease/lease_excutor.h"
|
||||
#include "curvefs/src/client/xattr_manager.h"
|
||||
#include "curvefs/src/client/warmup/warmup_manager.h"
|
||||
#include "src/common/throttle.h"
|
||||
#include "curvefs/src/client/filesystem/meta.h"
|
||||
#include "curvefs/src/client/filesystem/filesystem.h"
|
||||
|
||||
|
|
@ -66,7 +63,6 @@ using ::curve::common::InterruptibleSleeper;
|
|||
using ::curve::common::Thread;
|
||||
using ::curvefs::common::FSType;
|
||||
using ::curvefs::metaserver::DentryFlag;
|
||||
using ::curvefs::metaserver::ManageInodeType;
|
||||
using ::curvefs::client::metric::FSMetric;
|
||||
|
||||
namespace curvefs {
|
||||
|
|
@ -86,7 +82,6 @@ using rpcclient::MetaServerClientImpl;
|
|||
using ::curvefs::client::filesystem::FileSystem;
|
||||
using ::curvefs::client::filesystem::EntryOut;
|
||||
using ::curvefs::client::filesystem::AttrOut;
|
||||
using ::curvefs::client::filesystem::FileOut;
|
||||
|
||||
using curvefs::common::is_aligned;
|
||||
|
||||
|
|
@ -102,11 +97,11 @@ class FuseClient {
|
|||
inodeManager_(std::make_shared<InodeCacheManagerImpl>(metaClient_)),
|
||||
dentryManager_(std::make_shared<DentryCacheManagerImpl>(metaClient_)),
|
||||
fsInfo_(nullptr),
|
||||
mdsBase_(nullptr),
|
||||
isStop_(true),
|
||||
init_(false),
|
||||
enableSumInDir_(false),
|
||||
warmupManager_(nullptr),
|
||||
mdsBase_(nullptr),
|
||||
isStop_(true) {}
|
||||
warmupManager_(nullptr) {}
|
||||
|
||||
virtual ~FuseClient() {}
|
||||
|
||||
|
|
@ -120,11 +115,11 @@ class FuseClient {
|
|||
inodeManager_(inodeManager),
|
||||
dentryManager_(dentryManager),
|
||||
fsInfo_(nullptr),
|
||||
mdsBase_(nullptr),
|
||||
isStop_(true),
|
||||
init_(false),
|
||||
enableSumInDir_(false),
|
||||
warmupManager_(warmupManager),
|
||||
mdsBase_(nullptr),
|
||||
isStop_(true) {}
|
||||
warmupManager_(warmupManager) {}
|
||||
|
||||
virtual CURVEFS_ERROR Init(const FuseClientOption &option);
|
||||
|
||||
|
|
@ -142,7 +137,7 @@ class FuseClient {
|
|||
virtual CURVEFS_ERROR FuseOpWrite(fuse_req_t req, fuse_ino_t ino,
|
||||
const char* buf, size_t size, off_t off,
|
||||
struct fuse_file_info* fi,
|
||||
FileOut* fileOut) = 0;
|
||||
size_t* wSize) = 0;
|
||||
|
||||
virtual CURVEFS_ERROR FuseOpRead(fuse_req_t req, fuse_ino_t ino,
|
||||
size_t size, off_t off,
|
||||
|
|
@ -156,8 +151,7 @@ class FuseClient {
|
|||
|
||||
virtual CURVEFS_ERROR FuseOpOpen(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct fuse_file_info* fi,
|
||||
FileOut* fileOut);
|
||||
struct fuse_file_info* fi);
|
||||
|
||||
virtual CURVEFS_ERROR FuseOpCreate(fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
|
|
@ -252,16 +246,11 @@ class FuseClient {
|
|||
struct fuse_file_info* fi) = 0;
|
||||
virtual CURVEFS_ERROR FuseOpFlush(fuse_req_t req, fuse_ino_t ino,
|
||||
struct fuse_file_info *fi) {
|
||||
(void)req;
|
||||
(void)ino;
|
||||
(void)fi;
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
virtual CURVEFS_ERROR FuseOpStatFs(fuse_req_t req, fuse_ino_t ino,
|
||||
struct statvfs* stbuf) {
|
||||
(void)req;
|
||||
(void)ino;
|
||||
// TODO(chengyi01,wuhanqing): implement in s3 and volume client
|
||||
stbuf->f_frsize = stbuf->f_bsize = fsInfo_->blocksize();
|
||||
stbuf->f_blocks = 10UL << 30;
|
||||
|
|
@ -305,17 +294,20 @@ class FuseClient {
|
|||
enableSumInDir_ = enable;
|
||||
}
|
||||
|
||||
bool PutWarmFilelistTask(fuse_ino_t key, common::WarmupStorageType type) {
|
||||
bool EnableXattrSumming() {
|
||||
return enableSumInDir_;
|
||||
}
|
||||
|
||||
bool PutWarmFilelistTask(fuse_ino_t key) {
|
||||
if (fsInfo_->fstype() == FSType::TYPE_S3) {
|
||||
return warmupManager_->AddWarmupFilelist(key, type);
|
||||
return warmupManager_->AddWarmupFilelist(key);
|
||||
} // only support s3
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PutWarmFileTask(fuse_ino_t key, const std::string &path,
|
||||
common::WarmupStorageType type) {
|
||||
bool PutWarmFileTask(fuse_ino_t key, const std::string& path) {
|
||||
if (fsInfo_->fstype() == FSType::TYPE_S3) {
|
||||
return warmupManager_->AddWarmupFile(key, path, type);
|
||||
return warmupManager_->AddWarmupFile(key, path);
|
||||
} // only support s3
|
||||
return true;
|
||||
}
|
||||
|
|
@ -327,12 +319,6 @@ class FuseClient {
|
|||
return false;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR SetMountStatus(const struct MountOption *mountOption);
|
||||
|
||||
void Add(bool isRead, size_t size) { throttle_.Add(isRead, size); }
|
||||
|
||||
void InitQosParam();
|
||||
|
||||
protected:
|
||||
CURVEFS_ERROR MakeNode(fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
|
|
@ -341,29 +327,11 @@ class FuseClient {
|
|||
FsFileType type,
|
||||
dev_t rdev,
|
||||
bool internal,
|
||||
std::shared_ptr<InodeWrapper>& InodeWrapper); // NOLINT
|
||||
std::shared_ptr<InodeWrapper>& InodeWrapper);
|
||||
|
||||
CURVEFS_ERROR RemoveNode(fuse_req_t req, fuse_ino_t parent,
|
||||
const char* name, FsFileType type);
|
||||
|
||||
CURVEFS_ERROR CreateManageNode(fuse_req_t req,
|
||||
uint64_t parent,
|
||||
const char* name,
|
||||
mode_t mode,
|
||||
ManageInodeType manageType,
|
||||
EntryOut* entryOut);
|
||||
|
||||
CURVEFS_ERROR GetOrCreateRecycleDir(fuse_req_t req, Dentry *out);
|
||||
|
||||
CURVEFS_ERROR DeleteNode(fuse_ino_t ino, fuse_ino_t parent,
|
||||
const char* name, FsFileType type);
|
||||
|
||||
CURVEFS_ERROR MoveToRecycle(fuse_req_t req, fuse_ino_t ino,
|
||||
fuse_ino_t parent, const char* name,
|
||||
FsFileType type);
|
||||
|
||||
bool ShouldMoveToRecycle(fuse_ino_t parent);
|
||||
|
||||
CURVEFS_ERROR FuseOpLink(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
fuse_ino_t newparent,
|
||||
|
|
@ -373,8 +341,7 @@ class FuseClient {
|
|||
|
||||
CURVEFS_ERROR HandleOpenFlags(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct fuse_file_info* fi,
|
||||
FileOut* fileOut);
|
||||
struct fuse_file_info* fi);
|
||||
|
||||
int SetHostPortInMountPoint(Mountpoint* out) {
|
||||
char hostname[kMaxHostNameLength];
|
||||
|
|
@ -435,7 +402,7 @@ class FuseClient {
|
|||
bool init_;
|
||||
|
||||
// enable record summary info in dir inode xattr
|
||||
std::atomic<bool> enableSumInDir_;
|
||||
bool enableSumInDir_;
|
||||
|
||||
std::shared_ptr<FSMetric> fsMetric_;
|
||||
|
||||
|
|
@ -452,10 +419,6 @@ class FuseClient {
|
|||
Atomic<bool> isStop_;
|
||||
|
||||
curve::common::Mutex renameMutex_;
|
||||
|
||||
Throttle throttle_;
|
||||
|
||||
bthread_timer_t throttleTimer_;
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
struct MountOption {
|
||||
const char* mountPoint;
|
||||
const char* fsName;
|
||||
const char* fsType;
|
||||
char* mountPoint;
|
||||
char* fsName;
|
||||
char* fsType;
|
||||
char* conf;
|
||||
char* mdsAddr;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -67,20 +67,10 @@ CURVEFS_ERROR FuseS3Client::Init(const FuseClientOption &option) {
|
|||
|
||||
auto s3Client = std::make_shared<S3ClientImpl>();
|
||||
s3Client->Init(opt.s3Opt.s3AdaptrOpt);
|
||||
|
||||
const uint64_t writeCacheMaxByte =
|
||||
opt.s3Opt.s3ClientAdaptorOpt.writeCacheMaxByte;
|
||||
if (writeCacheMaxByte < MIN_WRITE_CACHE_SIZE) {
|
||||
LOG(ERROR) << "writeCacheMaxByte is too small"
|
||||
<< ", at least " << MIN_WRITE_CACHE_SIZE << " (8MB)"
|
||||
", writeCacheMaxByte = " << writeCacheMaxByte;
|
||||
return CURVEFS_ERROR::CACHETOOSMALL;
|
||||
}
|
||||
|
||||
auto fsCacheManager = std::make_shared<FsCacheManager>(
|
||||
dynamic_cast<S3ClientAdaptorImpl *>(s3Adaptor_.get()),
|
||||
opt.s3Opt.s3ClientAdaptorOpt.readCacheMaxByte, writeCacheMaxByte,
|
||||
opt.s3Opt.s3ClientAdaptorOpt.readCacheThreads, kvClientManager_);
|
||||
opt.s3Opt.s3ClientAdaptorOpt.readCacheMaxByte,
|
||||
opt.s3Opt.s3ClientAdaptorOpt.writeCacheMaxByte, kvClientManager_);
|
||||
if (opt.s3Opt.s3ClientAdaptorOpt.diskCacheOpt.diskCacheType !=
|
||||
DiskCacheType::Disable) {
|
||||
auto s3DiskCacheClient = std::make_shared<S3ClientImpl>();
|
||||
|
|
@ -155,8 +145,7 @@ CURVEFS_ERROR FuseS3Client::FuseOpInit(void *userdata,
|
|||
CURVEFS_ERROR FuseS3Client::FuseOpWrite(fuse_req_t req, fuse_ino_t ino,
|
||||
const char *buf, size_t size, off_t off,
|
||||
struct fuse_file_info *fi,
|
||||
FileOut* fileOut) {
|
||||
size_t *wSize = &fileOut->nwritten;
|
||||
size_t *wSize) {
|
||||
// check align
|
||||
if (fi->flags & O_DIRECT) {
|
||||
if (!(is_aligned(off, DirectIOAlignment) &&
|
||||
|
|
@ -218,8 +207,6 @@ CURVEFS_ERROR FuseS3Client::FuseOpWrite(fuse_req_t req, fuse_ino_t ino,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
inodeWrapper->GetInodeAttrLocked(&fileOut->attr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +214,6 @@ CURVEFS_ERROR FuseS3Client::FuseOpRead(fuse_req_t req, fuse_ino_t ino,
|
|||
size_t size, off_t off,
|
||||
struct fuse_file_info *fi, char *buffer,
|
||||
size_t *rSize) {
|
||||
(void)req;
|
||||
// check align
|
||||
if (fi->flags & O_DIRECT) {
|
||||
if (!(is_aligned(off, DirectIOAlignment) &&
|
||||
|
|
@ -246,7 +232,7 @@ CURVEFS_ERROR FuseS3Client::FuseOpRead(fuse_req_t req, fuse_ino_t ino,
|
|||
uint64_t fileSize = inodeWrapper->GetLength();
|
||||
|
||||
size_t len = 0;
|
||||
if (static_cast<int64_t>(fileSize) <= off) {
|
||||
if (fileSize <= off) {
|
||||
*rSize = 0;
|
||||
return CURVEFS_ERROR::OK;
|
||||
} else if (fileSize < off + size) {
|
||||
|
|
@ -343,8 +329,6 @@ CURVEFS_ERROR FuseS3Client::FuseOpUnlink(fuse_req_t req, fuse_ino_t parent,
|
|||
CURVEFS_ERROR FuseS3Client::FuseOpFsync(fuse_req_t req, fuse_ino_t ino,
|
||||
int datasync,
|
||||
struct fuse_file_info *fi) {
|
||||
(void)req;
|
||||
(void)fi;
|
||||
VLOG(1) << "FuseOpFsync, ino: " << ino << ", datasync: " << datasync;
|
||||
|
||||
CURVEFS_ERROR ret = s3Adaptor_->Flush(ino);
|
||||
|
|
@ -373,8 +357,6 @@ CURVEFS_ERROR FuseS3Client::Truncate(InodeWrapper *inode, uint64_t length) {
|
|||
|
||||
CURVEFS_ERROR FuseS3Client::FuseOpFlush(fuse_req_t req, fuse_ino_t ino,
|
||||
struct fuse_file_info *fi) {
|
||||
(void)req;
|
||||
(void)fi;
|
||||
VLOG(1) << "FuseOpFlush, ino: " << ino;
|
||||
CURVEFS_ERROR ret = CURVEFS_ERROR::OK;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#include "curvefs/src/client/fuse_client.h"
|
||||
#include "curvefs/src/client/s3/client_s3_cache_manager.h"
|
||||
#include "curvefs/src/client/warmup/warmup_manager.h"
|
||||
#include "curvefs/src/volume/common.h"
|
||||
#include "src/common/s3_adapter.h"
|
||||
|
||||
namespace curvefs {
|
||||
|
|
@ -41,7 +40,6 @@ namespace client {
|
|||
|
||||
using curve::common::GetObjectAsyncContext;
|
||||
using curve::common::GetObjectAsyncCallBack;
|
||||
using curvefs::volume::kMiB;
|
||||
namespace warmup {
|
||||
class WarmupManager;
|
||||
class WarmupManagerS3Impl;
|
||||
|
|
@ -81,7 +79,7 @@ class FuseS3Client : public FuseClient {
|
|||
|
||||
CURVEFS_ERROR FuseOpWrite(fuse_req_t req, fuse_ino_t ino,
|
||||
const char *buf, size_t size, off_t off,
|
||||
struct fuse_file_info *fi, FileOut* fileOut) override;
|
||||
struct fuse_file_info *fi, size_t *wSize) override;
|
||||
|
||||
CURVEFS_ERROR FuseOpRead(fuse_req_t req,
|
||||
fuse_ino_t ino, size_t size, off_t off,
|
||||
|
|
@ -129,8 +127,6 @@ class FuseS3Client : public FuseClient {
|
|||
// s3 adaptor
|
||||
std::shared_ptr<S3ClientAdaptor> s3Adaptor_;
|
||||
std::shared_ptr<KVClientManager> kvClientManager_;
|
||||
|
||||
static constexpr auto MIN_WRITE_CACHE_SIZE = 8 * kMiB;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -133,11 +133,10 @@ CURVEFS_ERROR FuseVolumeClient::FuseOpWrite(fuse_req_t req,
|
|||
size_t size,
|
||||
off_t off,
|
||||
struct fuse_file_info *fi,
|
||||
FileOut* fileOut) {
|
||||
size_t *wSize) {
|
||||
VLOG(9) << "write start, ino: " << ino << ", offset: " << off
|
||||
<< ", length: " << size;
|
||||
|
||||
size_t* wSize = &fileOut->nwritten;
|
||||
if (fi->flags & O_DIRECT) {
|
||||
if (!(is_aligned(off, DirectIOAlignment) &&
|
||||
is_aligned(size, DirectIOAlignment))) {
|
||||
|
|
@ -149,7 +148,7 @@ CURVEFS_ERROR FuseVolumeClient::FuseOpWrite(fuse_req_t req,
|
|||
butil::Timer timer;
|
||||
timer.start();
|
||||
|
||||
CURVEFS_ERROR ret = storage_->Write(ino, off, size, buf, fileOut);
|
||||
CURVEFS_ERROR ret = storage_->Write(ino, off, size, buf);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
if (fsMetric_) {
|
||||
fsMetric_->userWrite.eps.count << 1;
|
||||
|
|
@ -190,7 +189,6 @@ CURVEFS_ERROR FuseVolumeClient::FuseOpRead(fuse_req_t req,
|
|||
struct fuse_file_info *fi,
|
||||
char *buffer,
|
||||
size_t *rSize) {
|
||||
(void)req;
|
||||
VLOG(3) << "read start, ino: " << ino << ", offset: " << off
|
||||
<< ", length: " << size;
|
||||
|
||||
|
|
@ -241,8 +239,8 @@ CURVEFS_ERROR FuseVolumeClient::FuseOpCreate(fuse_req_t req, fuse_ino_t parent,
|
|||
<< ", mode: " << mode;
|
||||
|
||||
std::shared_ptr<InodeWrapper> inode;
|
||||
CURVEFS_ERROR ret = MakeNode(
|
||||
req, parent, name, mode, FsFileType::TYPE_FILE, 0, false, inode);
|
||||
CURVEFS_ERROR ret = MakeNode(req, parent, name, mode, FsFileType::TYPE_FILE, 0, false,
|
||||
inode);
|
||||
if (ret != CURVEFS_ERROR::OK) {
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -297,8 +295,6 @@ CURVEFS_ERROR FuseVolumeClient::FuseOpUnlink(fuse_req_t req, fuse_ino_t parent,
|
|||
CURVEFS_ERROR FuseVolumeClient::FuseOpFsync(fuse_req_t req, fuse_ino_t ino,
|
||||
int datasync,
|
||||
struct fuse_file_info *fi) {
|
||||
(void)req;
|
||||
(void)fi;
|
||||
VLOG(3) << "FuseOpFsync start, ino: " << ino << ", datasync: " << datasync;
|
||||
|
||||
CURVEFS_ERROR ret = storage_->Flush(ino);
|
||||
|
|
@ -325,16 +321,12 @@ CURVEFS_ERROR FuseVolumeClient::FuseOpFsync(fuse_req_t req, fuse_ino_t ino,
|
|||
}
|
||||
|
||||
CURVEFS_ERROR FuseVolumeClient::Truncate(InodeWrapper *inode, uint64_t length) {
|
||||
(void)inode;
|
||||
(void)length;
|
||||
// Todo: call volume truncate
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR FuseVolumeClient::FuseOpFlush(fuse_req_t req, fuse_ino_t ino,
|
||||
struct fuse_file_info *fi) {
|
||||
(void)req;
|
||||
(void)fi;
|
||||
VLOG(9) << "FuseOpFlush, ino: " << ino;
|
||||
|
||||
CURVEFS_ERROR ret = storage_->Flush(ino);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class FuseVolumeClient : public FuseClient {
|
|||
|
||||
CURVEFS_ERROR FuseOpWrite(fuse_req_t req, fuse_ino_t ino,
|
||||
const char *buf, size_t size, off_t off,
|
||||
struct fuse_file_info *fi, FileOut* fileOut) override;
|
||||
struct fuse_file_info *fi, size_t *wSize) override;
|
||||
|
||||
CURVEFS_ERROR FuseOpRead(fuse_req_t req,
|
||||
fuse_ino_t ino, size_t size, off_t off,
|
||||
|
|
|
|||
|
|
@ -202,23 +202,6 @@ CURVEFS_ERROR InodeCacheManagerImpl::CreateInode(
|
|||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR InodeCacheManagerImpl::CreateManageInode(
|
||||
const InodeParam ¶m,
|
||||
std::shared_ptr<InodeWrapper> &out) {
|
||||
Inode inode;
|
||||
MetaStatusCode ret = metaClient_->CreateManageInode(param, &inode);
|
||||
if (ret != MetaStatusCode::OK) {
|
||||
LOG(ERROR) << "metaClient_ CreateManageInode failed, MetaStatusCode = "
|
||||
<< ret << ", MetaStatusCode_Name = "
|
||||
<< MetaStatusCode_Name(ret);
|
||||
return ToFSError(ret);
|
||||
}
|
||||
out = std::make_shared<InodeWrapper>(std::move(inode), metaClient_,
|
||||
s3ChunkInfoMetric_, option_.maxDataSize,
|
||||
option_.refreshDataIntervalSec);
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
CURVEFS_ERROR InodeCacheManagerImpl::DeleteInode(uint64_t inodeId) {
|
||||
NameLockGuard lock(nameLock_, std::to_string(inodeId));
|
||||
MetaStatusCode ret = metaClient_->DeleteInode(fsId_, inodeId);
|
||||
|
|
|
|||
|
|
@ -104,9 +104,6 @@ class InodeCacheManager {
|
|||
virtual CURVEFS_ERROR CreateInode(const InodeParam ¶m,
|
||||
std::shared_ptr<InodeWrapper> &out) = 0; // NOLINT
|
||||
|
||||
virtual CURVEFS_ERROR CreateManageInode(const InodeParam ¶m,
|
||||
std::shared_ptr<InodeWrapper> &out) = 0; // NOLINT
|
||||
|
||||
virtual CURVEFS_ERROR DeleteInode(uint64_t inodeId) = 0;
|
||||
|
||||
virtual void ShipToFlush(
|
||||
|
|
@ -118,6 +115,7 @@ class InodeCacheManager {
|
|||
|
||||
class InodeCacheManagerImpl : public InodeCacheManager,
|
||||
public std::enable_shared_from_this<InodeCacheManagerImpl> {
|
||||
|
||||
public:
|
||||
InodeCacheManagerImpl()
|
||||
: metaClient_(std::make_shared<MetaServerClientImpl>()) {}
|
||||
|
|
@ -154,9 +152,6 @@ class InodeCacheManagerImpl : public InodeCacheManager,
|
|||
CURVEFS_ERROR CreateInode(const InodeParam ¶m,
|
||||
std::shared_ptr<InodeWrapper> &out) override;
|
||||
|
||||
CURVEFS_ERROR CreateManageInode(const InodeParam ¶m,
|
||||
std::shared_ptr<InodeWrapper> &out) override;
|
||||
|
||||
CURVEFS_ERROR DeleteInode(uint64_t inodeId) override;
|
||||
|
||||
void ShipToFlush(
|
||||
|
|
|
|||
|
|
@ -107,7 +107,6 @@ class UpdateInodeAsyncDone : public MetaServerClientDone {
|
|||
<< ", inodeid: " << inodeWrapper_->GetInodeId();
|
||||
inodeWrapper_->MarkInodeError();
|
||||
}
|
||||
inodeWrapper_->ClearDirty();
|
||||
inodeWrapper_->ReleaseSyncingInode();
|
||||
|
||||
if (parent_ != nullptr) {
|
||||
|
|
@ -227,6 +226,7 @@ void InodeWrapper::AsyncFlushAttr(MetaServerClientDone* done,
|
|||
metaClient_->UpdateInodeWithOutNlinkAsync(
|
||||
inode_.fsid(), inode_.inodeid(), dirtyAttr_,
|
||||
new UpdateInodeAsyncDone(shared_from_this(), done));
|
||||
dirty_ = false;
|
||||
dirtyAttr_.Clear();
|
||||
return;
|
||||
}
|
||||
|
|
@ -301,7 +301,7 @@ CURVEFS_ERROR InodeWrapper::RefreshS3ChunkInfo() {
|
|||
UpdateS3ChunkInfoMetric(CalS3ChunkInfoSize() - before);
|
||||
ClearS3ChunkInfoAdd();
|
||||
UpdateMaxS3ChunkInfoSize();
|
||||
lastRefreshTime_ = TimeUtility::GetTimeofDaySec();
|
||||
lastRefreshTime_ = ::curve::common::TimeUtility::GetTimeofDaySec();
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
|
|
@ -489,6 +489,7 @@ void InodeWrapper::AsyncFlushAttrAndExtents(MetaServerClientDone *done,
|
|||
new UpdateInodeAttrAndExtentClosure{shared_from_this(), done},
|
||||
std::move(indices));
|
||||
|
||||
dirty_ = false;
|
||||
dirtyAttr_.Clear();
|
||||
return;
|
||||
}
|
||||
|
|
@ -542,7 +543,6 @@ class UpdateInodeAsyncS3Done : public MetaServerClientDone {
|
|||
inodeWrapper_->MarkInodeError();
|
||||
}
|
||||
VLOG(9) << "inode " << inodeWrapper_->GetInodeId() << " async success.";
|
||||
inodeWrapper_->ClearDirty();
|
||||
inodeWrapper_->ReleaseSyncingInode();
|
||||
inodeWrapper_->ReleaseSyncingS3ChunkInfo();
|
||||
|
||||
|
|
@ -559,7 +559,6 @@ class UpdateInodeAsyncS3Done : public MetaServerClientDone {
|
|||
} // namespace
|
||||
|
||||
void InodeWrapper::AsyncS3(MetaServerClientDone *done, bool internal) {
|
||||
(void)internal;
|
||||
if (dirty_ || !s3ChunkInfoAdd_.empty()) {
|
||||
LockSyncingInode();
|
||||
LockSyncingS3ChunkInfo();
|
||||
|
|
@ -571,6 +570,7 @@ void InodeWrapper::AsyncS3(MetaServerClientDone *done, bool internal) {
|
|||
inode_.fsid(), inode_.inodeid(), dirtyAttr_,
|
||||
new UpdateInodeAsyncS3Done{shared_from_this(), done},
|
||||
std::move(indices));
|
||||
dirty_ = false;
|
||||
dirtyAttr_.Clear();
|
||||
ClearS3ChunkInfoAdd();
|
||||
return;
|
||||
|
|
@ -610,8 +610,7 @@ CURVEFS_ERROR InodeWrapper::RefreshNlink() {
|
|||
return CURVEFS_ERROR::INTERNAL;
|
||||
}
|
||||
inode_.set_nlink(attr.nlink());
|
||||
VLOG(3) << "RefreshNlink from metaserver, newnlink: " << attr.nlink()
|
||||
<< ", inodeid: " << inode_.inodeid();
|
||||
VLOG(3) << "RefreshNlink from metaserver, newnlink: " << attr.nlink();
|
||||
return CURVEFS_ERROR::OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ using rpcclient::MetaServerClientImpl;
|
|||
using rpcclient::MetaServerClientDone;
|
||||
using metric::S3ChunkInfoMetric;
|
||||
using common::NlinkChange;
|
||||
using curve::common::TimeUtility;
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const struct stat &attr);
|
||||
void AppendS3ChunkInfoToMap(uint64_t chunkIndex, const S3ChunkInfo &info,
|
||||
|
|
@ -78,19 +77,18 @@ class InodeWrapper : public std::enable_shared_from_this<InodeWrapper> {
|
|||
InodeWrapper(Inode inode,
|
||||
std::shared_ptr<MetaServerClient> metaClient,
|
||||
std::shared_ptr<S3ChunkInfoMetric> s3ChunkInfoMetric = nullptr,
|
||||
int64_t maxDataSize = LONG_MAX,
|
||||
uint64_t maxDataSize = ULONG_MAX,
|
||||
uint32_t refreshDataInterval = UINT_MAX)
|
||||
: inode_(std::move(inode)),
|
||||
status_(InodeStatus::kNormal),
|
||||
baseMaxDataSize_(maxDataSize),
|
||||
maxDataSize_(maxDataSize),
|
||||
refreshDataInterval_(refreshDataInterval),
|
||||
lastRefreshTime_(TimeUtility::GetTimeofDaySec()),
|
||||
lastRefreshTime_(::curve::common::TimeUtility::GetTimeofDaySec()),
|
||||
s3ChunkInfoAddSize_(0),
|
||||
metaClient_(std::move(metaClient)),
|
||||
s3ChunkInfoMetric_(std::move(s3ChunkInfoMetric)),
|
||||
dirty_(false),
|
||||
time_(TimeUtility::GetTimeofDaySec()) {
|
||||
dirty_(false) {
|
||||
UpdateS3ChunkInfoMetric(CalS3ChunkInfoSize());
|
||||
g_alive_inode_count << 1;
|
||||
}
|
||||
|
|
@ -339,10 +337,6 @@ class InodeWrapper : public std::enable_shared_from_this<InodeWrapper> {
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32_t GetCachedTime() const {
|
||||
return time_;
|
||||
}
|
||||
|
||||
private:
|
||||
CURVEFS_ERROR SyncS3ChunkInfo(bool internal = false);
|
||||
|
||||
|
|
@ -398,8 +392,8 @@ class InodeWrapper : public std::enable_shared_from_this<InodeWrapper> {
|
|||
InodeAttr dirtyAttr_;
|
||||
|
||||
InodeStatus status_;
|
||||
int64_t baseMaxDataSize_;
|
||||
int64_t maxDataSize_;
|
||||
uint64_t baseMaxDataSize_;
|
||||
uint64_t maxDataSize_;
|
||||
uint32_t refreshDataInterval_;
|
||||
uint64_t lastRefreshTime_;
|
||||
|
||||
|
|
@ -417,9 +411,6 @@ class InodeWrapper : public std::enable_shared_from_this<InodeWrapper> {
|
|||
|
||||
mutable ::curve::common::Mutex syncingVolumeExtentsMtx_;
|
||||
ExtentCache extentCache_;
|
||||
|
||||
// timestamp when put in cache
|
||||
uint64_t time_;
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
|
|
|
|||
|
|
@ -118,8 +118,6 @@ class MemCachedClient : public KVClient {
|
|||
return true;
|
||||
}
|
||||
*errorlog = ResError(res);
|
||||
memcached_free(tcli);
|
||||
tcli = nullptr;
|
||||
LOG(ERROR) << "Set key = " << key << " error = " << *errorlog;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -146,11 +144,9 @@ class MemCachedClient : public KVClient {
|
|||
|
||||
*errorlog = ResError(ue);
|
||||
if (ue != MEMCACHED_NOTFOUND) {
|
||||
LOG(ERROR) << "Get key = " << key << " error = " << *errorlog
|
||||
<< ", get_value_len = " << value_length
|
||||
<< ", expect_value_len = " << length;
|
||||
memcached_free(tcli);
|
||||
tcli = nullptr;
|
||||
LOG(ERROR) << "Get key = " << key << " error = " << *errorlog
|
||||
<< ", get_value_len = " << value_length
|
||||
<< ", expect_value_len = " << length;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ LeaseExecutor::~LeaseExecutor() {
|
|||
bool LeaseExecutor::Start() {
|
||||
if (opt_.leaseTimeUs <= 0 || opt_.refreshTimesPerLease <= 0) {
|
||||
LOG(ERROR) << "LeaseExecutor start fail. Invalid param in leaseopt, "
|
||||
"leaseTimeUs = "
|
||||
"leasTimesUs = "
|
||||
<< opt_.leaseTimeUs
|
||||
<< ", refreshTimePerLease = " << opt_.refreshTimesPerLease;
|
||||
return false;
|
||||
|
|
@ -78,8 +78,7 @@ bool LeaseExecutor::RefreshLease() {
|
|||
// refresh from mds
|
||||
std::vector<PartitionTxId> latestTxIdList;
|
||||
FSStatusCode ret = mdsCli_->RefreshSession(txIds, &latestTxIdList,
|
||||
fsName_, mountpoint_,
|
||||
enableSumInDir_);
|
||||
fsName_, mountpoint_);
|
||||
if (ret != FSStatusCode::OK) {
|
||||
LOG(ERROR) << "LeaseExecutor refresh session fail, ret = " << ret
|
||||
<< ", errorName = " << FSStatusCode_Name(ret);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
|
||||
#include "curvefs/src/client/rpcclient/metacache.h"
|
||||
#include "curvefs/src/client/rpcclient/mds_client.h"
|
||||
|
|
@ -45,10 +44,8 @@ namespace client {
|
|||
class LeaseExecutor : public LeaseExecutorBase {
|
||||
public:
|
||||
LeaseExecutor(const LeaseOpt &opt, std::shared_ptr<MetaCache> metaCache,
|
||||
std::shared_ptr<MdsClient> mdsCli,
|
||||
std::atomic<bool>* enableSumInDir)
|
||||
: opt_(opt), metaCache_(metaCache), mdsCli_(mdsCli),
|
||||
enableSumInDir_(enableSumInDir) {}
|
||||
std::shared_ptr<MdsClient> mdsCli)
|
||||
: opt_(opt), metaCache_(metaCache), mdsCli_(mdsCli) {}
|
||||
|
||||
~LeaseExecutor();
|
||||
|
||||
|
|
@ -76,7 +73,6 @@ class LeaseExecutor : public LeaseExecutorBase {
|
|||
std::unique_ptr<RefreshSessionTask> task_;
|
||||
std::string fsName_;
|
||||
Mountpoint mountpoint_;
|
||||
std::atomic<bool>* enableSumInDir_;
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@
|
|||
* Author: xuchaojie
|
||||
*/
|
||||
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "curvefs/src/client/curve_fuse_op.h"
|
||||
#include "curvefs/src/client/fuse_common.h"
|
||||
|
||||
|
|
@ -107,7 +103,7 @@ void extra_options_help() {
|
|||
|
||||
std::string match_any_pattern(
|
||||
const std::unordered_map<std::string, char**>& patterns, const char* src) {
|
||||
size_t src_len = strlen(src);
|
||||
int src_len = strlen(src);
|
||||
for (const auto& pair : patterns) {
|
||||
const auto& pattern = pair.first;
|
||||
if (pattern.length() < src_len &&
|
||||
|
|
@ -224,14 +220,14 @@ int main(int argc, char *argv[]) {
|
|||
printf("Init log failed, confpath = %s\n", mOpts.conf);
|
||||
}
|
||||
|
||||
ret = InitFuseClient(&mOpts);
|
||||
ret = InitFuseClient(mOpts.conf, mOpts.fsName, mOpts.fsType, mOpts.mdsAddr);
|
||||
if (ret < 0) {
|
||||
LOG(ERROR) << "init fuse client fail, conf = " << mOpts.conf;
|
||||
printf("init fuse client fail, conf =%s\n", mOpts.conf);
|
||||
goto err_out4;
|
||||
}
|
||||
|
||||
LOG(INFO) << "fuse start loop, singlethread = " << opts.singlethread
|
||||
<< ", max_idle_threads = " << opts.max_idle_threads;
|
||||
printf("fuse start loop, singlethread = %d, max_idle_threads = %d\n",
|
||||
opts.singlethread, opts.max_idle_threads);
|
||||
|
||||
/* Block until ctrl+c or fusermount -u */
|
||||
if (opts.singlethread) {
|
||||
|
|
|
|||
|
|
@ -22,9 +22,5 @@ cc_library(
|
|||
hdrs = glob(["*.h"]),
|
||||
copts = CURVE_DEFAULT_COPTS,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//external:gflags",
|
||||
"//external:bvar",
|
||||
"//src/client:curve_client",
|
||||
],
|
||||
deps = ["//external:gflags"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2023 NetEase Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Project: curve
|
||||
* Created Date: Fri Apr 21 2023
|
||||
* Author: Xinlong-Chen
|
||||
*/
|
||||
|
||||
#include "curvefs/src/client/metric/client_metric.h"
|
||||
|
||||
namespace curvefs {
|
||||
namespace client {
|
||||
namespace metric {
|
||||
|
||||
const std::string MDSClientMetric::prefix = "curvefs_mds_client"; // NOLINT
|
||||
const std::string MetaServerClientMetric::prefix = "curvefs_metaserver_client"; // NOLINT
|
||||
const std::string ClientOpMetric::prefix = "curvefs_client"; // NOLINT
|
||||
const std::string S3MultiManagerMetric::prefix = "curvefs_client_manager"; // NOLINT
|
||||
const std::string FSMetric::prefix = "curvefs_client"; // NOLINT
|
||||
const std::string S3Metric::prefix = "curvefs_s3"; // NOLINT
|
||||
const std::string DiskCacheMetric::prefix = "curvefs_disk_cache"; // NOLINT
|
||||
const std::string KVClientMetric::prefix = "curvefs_kvclient"; // NOLINT
|
||||
const std::string S3ChunkInfoMetric::prefix = "inode_s3_chunk_info"; // NOLINT
|
||||
const std::string WarmupManagerS3Metric::prefix = "curvefs_warmup"; // NOLINT
|
||||
|
||||
} // namespace metric
|
||||
} // namespace client
|
||||
} // namespace curvefs
|
||||
|
||||
|
|
@ -36,7 +36,8 @@ namespace client {
|
|||
namespace metric {
|
||||
|
||||
struct MDSClientMetric {
|
||||
static const std::string prefix;
|
||||
std::string prefix;
|
||||
std::string mdsAddrs;
|
||||
|
||||
InterfaceMetric mountFs;
|
||||
InterfaceMetric umountFs;
|
||||
|
|
@ -52,8 +53,11 @@ struct MDSClientMetric {
|
|||
InterfaceMetric commitTx;
|
||||
InterfaceMetric allocOrGetMemcacheCluster;
|
||||
|
||||
MDSClientMetric()
|
||||
: mountFs(prefix, "mountFs"),
|
||||
explicit MDSClientMetric(const std::string& prefix_ = "")
|
||||
: prefix(!prefix_.empty() ? prefix_
|
||||
: "curvefs_mds_client_" +
|
||||
curve::common::ToHexString(this)),
|
||||
mountFs(prefix, "mountFs"),
|
||||
umountFs(prefix, "umountFs"),
|
||||
getFsInfo(prefix, "getFsInfo"),
|
||||
getMetaServerInfo(prefix, "getMetaServerInfo"),
|
||||
|
|
@ -69,7 +73,7 @@ struct MDSClientMetric {
|
|||
};
|
||||
|
||||
struct MetaServerClientMetric {
|
||||
static const std::string prefix;
|
||||
std::string prefix;
|
||||
|
||||
// dentry
|
||||
InterfaceMetric getDentry;
|
||||
|
|
@ -93,8 +97,11 @@ struct MetaServerClientMetric {
|
|||
InterfaceMetric updateVolumeExtent;
|
||||
InterfaceMetric getVolumeExtent;
|
||||
|
||||
MetaServerClientMetric()
|
||||
: getDentry(prefix, "getDentry"),
|
||||
explicit MetaServerClientMetric(const std::string &prefix_ = "")
|
||||
: prefix(!prefix_.empty() ? prefix_
|
||||
: "curvefs_metaserver_client_" +
|
||||
curve::common::ToHexString(this)),
|
||||
getDentry(prefix, "getDentry"),
|
||||
listDentry(prefix, "listDentry"),
|
||||
createDentry(prefix, "createDentry"),
|
||||
deleteDentry(prefix, "deleteDentry"),
|
||||
|
|
@ -135,7 +142,7 @@ struct OpMetric {
|
|||
};
|
||||
|
||||
struct ClientOpMetric {
|
||||
static const std::string prefix;
|
||||
std::string prefix;
|
||||
|
||||
OpMetric opLookup;
|
||||
OpMetric opOpen;
|
||||
|
|
@ -162,8 +169,10 @@ struct ClientOpMetric {
|
|||
OpMetric opWrite;
|
||||
|
||||
|
||||
ClientOpMetric()
|
||||
: opLookup(prefix, "opLookup"),
|
||||
explicit ClientOpMetric(const std::string &prefix_ = "")
|
||||
: prefix(!prefix_.empty() ? prefix_
|
||||
: "curvefs_client"),
|
||||
opLookup(prefix, "opLookup"),
|
||||
opOpen(prefix, "opOpen"),
|
||||
opCreate(prefix, "opCreate"),
|
||||
opMkNod(prefix, "opMkNod"),
|
||||
|
|
@ -189,8 +198,7 @@ struct ClientOpMetric {
|
|||
};
|
||||
|
||||
struct S3MultiManagerMetric {
|
||||
static const std::string prefix;
|
||||
|
||||
const std::string prefix;
|
||||
bvar::Adder<int64_t> fileManagerNum;
|
||||
bvar::Adder<int64_t> chunkManagerNum;
|
||||
bvar::Adder<int64_t> writeDataCacheNum;
|
||||
|
|
@ -198,7 +206,9 @@ struct S3MultiManagerMetric {
|
|||
bvar::Adder<int64_t> readDataCacheNum;
|
||||
bvar::Adder<int64_t> readDataCacheByte;
|
||||
|
||||
S3MultiManagerMetric() {
|
||||
explicit S3MultiManagerMetric(
|
||||
const std::string &prefix_ = "curvefs_client_manager")
|
||||
: prefix(prefix_) {
|
||||
fileManagerNum.expose_as(prefix, "file_manager_num");
|
||||
chunkManagerNum.expose_as(prefix, "chunk_manager_num");
|
||||
writeDataCacheNum.expose_as(prefix, "write_data_cache_num");
|
||||
|
|
@ -209,7 +219,7 @@ struct S3MultiManagerMetric {
|
|||
};
|
||||
|
||||
struct FSMetric {
|
||||
static const std::string prefix;
|
||||
const std::string prefix = "curvefs_client";
|
||||
|
||||
std::string fsName;
|
||||
|
||||
|
|
@ -228,7 +238,7 @@ struct FSMetric {
|
|||
};
|
||||
|
||||
struct S3Metric {
|
||||
static const std::string prefix;
|
||||
const std::string prefix = "curvefs_s3";
|
||||
|
||||
std::string fsName;
|
||||
InterfaceMetric adaptorWrite;
|
||||
|
|
@ -254,7 +264,7 @@ struct S3Metric {
|
|||
};
|
||||
|
||||
struct DiskCacheMetric {
|
||||
static const std::string prefix;
|
||||
const std::string prefix = "curvefs_disk_cache";
|
||||
|
||||
std::string fsName;
|
||||
InterfaceMetric writeS3;
|
||||
|
|
@ -268,16 +278,16 @@ struct DiskCacheMetric {
|
|||
};
|
||||
|
||||
struct KVClientMetric {
|
||||
static const std::string prefix;
|
||||
InterfaceMetric kvClientGet;
|
||||
const std::string prefix = "curvefs_kvclient";
|
||||
InterfaceMetric kvClientSet;
|
||||
InterfaceMetric kvClientGet;
|
||||
|
||||
KVClientMetric()
|
||||
: kvClientGet(prefix, "get"), kvClientSet(prefix, "set") {}
|
||||
};
|
||||
|
||||
struct S3ChunkInfoMetric {
|
||||
static const std::string prefix;
|
||||
const std::string prefix = "inode_s3_chunk_info";
|
||||
|
||||
bvar::Adder<int64_t> s3ChunkInfoSize;
|
||||
|
||||
|
|
@ -285,8 +295,7 @@ struct S3ChunkInfoMetric {
|
|||
};
|
||||
|
||||
struct WarmupManagerS3Metric {
|
||||
static const std::string prefix;
|
||||
|
||||
const std::string prefix = "curvefs_warmup";
|
||||
InterfaceMetric warmupS3Cached;
|
||||
bvar::Adder<uint64_t> warmupS3CacheSize;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ using curvefs::metaserver::CreateDentryRequest;
|
|||
using curvefs::metaserver::CreateDentryResponse;
|
||||
using curvefs::metaserver::CreateInodeRequest;
|
||||
using curvefs::metaserver::CreateInodeResponse;
|
||||
using curvefs::metaserver::CreateManageInodeRequest;
|
||||
using curvefs::metaserver::CreateManageInodeResponse;
|
||||
using curvefs::metaserver::DeleteDentryRequest;
|
||||
using curvefs::metaserver::DeleteDentryResponse;
|
||||
using curvefs::metaserver::DeleteInodeRequest;
|
||||
|
|
@ -61,7 +59,6 @@ using curvefs::metaserver::PrepareRenameTxRequest;
|
|||
using curvefs::metaserver::PrepareRenameTxResponse;
|
||||
using curvefs::metaserver::UpdateInodeRequest;
|
||||
using curvefs::metaserver::UpdateInodeResponse;
|
||||
using curvefs::metaserver::ManageInodeType;
|
||||
|
||||
using curvefs::common::FSType;
|
||||
using curvefs::common::PartitionInfo;
|
||||
|
|
@ -125,7 +122,6 @@ struct InodeParam {
|
|||
uint64_t rdev;
|
||||
std::string symlink;
|
||||
uint64_t parent;
|
||||
ManageInodeType manageType = ManageInodeType::TYPE_NOT_MANAGE;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, const InodeParam& p) {
|
||||
|
|
|
|||
|
|
@ -59,8 +59,6 @@ MdsClientImpl::Init(const ::curve::client::MetaServerOption &mdsOpt,
|
|||
FSStatusCode MdsClientImpl::MountFs(const std::string& fsName,
|
||||
const Mountpoint& mountPt, FsInfo* fsInfo) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.mountFs.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.mountFs.latency);
|
||||
MountFsResponse response;
|
||||
|
|
@ -90,8 +88,6 @@ FSStatusCode MdsClientImpl::MountFs(const std::string& fsName,
|
|||
FSStatusCode MdsClientImpl::UmountFs(const std::string& fsName,
|
||||
const Mountpoint& mountPt) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.umountFs.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.umountFs.latency);
|
||||
UmountFsResponse response;
|
||||
|
|
@ -117,8 +113,6 @@ FSStatusCode MdsClientImpl::UmountFs(const std::string& fsName,
|
|||
FSStatusCode MdsClientImpl::GetFsInfo(const std::string &fsName,
|
||||
FsInfo *fsInfo) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.getFsInfo.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.getFsInfo.latency);
|
||||
GetFsInfoResponse response;
|
||||
|
|
@ -149,8 +143,6 @@ FSStatusCode MdsClientImpl::GetFsInfo(const std::string &fsName,
|
|||
|
||||
FSStatusCode MdsClientImpl::GetFsInfo(uint32_t fsId, FsInfo *fsInfo) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.getFsInfo.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.getFsInfo.latency);
|
||||
GetFsInfoResponse response;
|
||||
|
|
@ -211,9 +203,6 @@ bool MdsClientImpl::GetMetaServerInfo(
|
|||
::curve::common::StringToUll(strs[1], &port);
|
||||
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
(void)addrindex;
|
||||
mdsClientMetric_.getMetaServerInfo.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.getMetaServerInfo.latency);
|
||||
GetMetaServerInfoResponse response;
|
||||
|
|
@ -250,8 +239,6 @@ bool MdsClientImpl::GetMetaServerListInCopysets(
|
|||
const LogicPoolID &logicalpooid, const std::vector<CopysetID> ©setidvec,
|
||||
std::vector<CopysetInfo<MetaserverID>> *cpinfoVec) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.getMetaServerListInCopysets.qps.count << 1;
|
||||
LatencyUpdater updater(
|
||||
&mdsClientMetric_.getMetaServerListInCopysets.latency);
|
||||
|
|
@ -303,8 +290,6 @@ bool MdsClientImpl::GetMetaServerListInCopysets(
|
|||
bool MdsClientImpl::CreatePartition(
|
||||
uint32_t fsID, uint32_t count, std::vector<PartitionInfo> *partitionInfos) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.createPartition.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.createPartition.latency);
|
||||
CreatePartitionResponse response;
|
||||
|
|
@ -350,8 +335,6 @@ bool MdsClientImpl::GetCopysetOfPartitions(
|
|||
const std::vector<uint32_t> &partitionIDList,
|
||||
std::map<uint32_t, Copyset> *copysetMap) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.getCopysetOfPartitions.qps.count << 1;
|
||||
LatencyUpdater updater(
|
||||
&mdsClientMetric_.getCopysetOfPartitions.latency);
|
||||
|
|
@ -396,8 +379,6 @@ bool MdsClientImpl::GetCopysetOfPartitions(
|
|||
bool MdsClientImpl::ListPartition(uint32_t fsID,
|
||||
std::vector<PartitionInfo> *partitionInfos) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.listPartition.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.listPartition.latency);
|
||||
ListPartitionResponse response;
|
||||
|
|
@ -435,8 +416,6 @@ bool MdsClientImpl::ListPartition(uint32_t fsID,
|
|||
bool MdsClientImpl::AllocOrGetMemcacheCluster(uint32_t fsId,
|
||||
MemcacheClusterInfo* cluster) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.allocOrGetMemcacheCluster.qps.count << 1;
|
||||
LatencyUpdater updater(
|
||||
&mdsClientMetric_.allocOrGetMemcacheCluster.latency);
|
||||
|
|
@ -468,8 +447,6 @@ bool MdsClientImpl::AllocOrGetMemcacheCluster(uint32_t fsId,
|
|||
FSStatusCode MdsClientImpl::AllocS3ChunkId(uint32_t fsId, uint32_t idNum,
|
||||
uint64_t *chunkId) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.allocS3ChunkId.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.allocS3ChunkId.latency);
|
||||
AllocateS3ChunkResponse response;
|
||||
|
|
@ -501,11 +478,8 @@ FSStatusCode
|
|||
MdsClientImpl::RefreshSession(const std::vector<PartitionTxId> &txIds,
|
||||
std::vector<PartitionTxId> *latestTxIdList,
|
||||
const std::string& fsName,
|
||||
const Mountpoint& mountpoint,
|
||||
std::atomic<bool>* enableSumInDir) {
|
||||
const Mountpoint& mountpoint) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
mdsClientMetric_.refreshSession.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.refreshSession.latency);
|
||||
RefreshSessionRequest request;
|
||||
|
|
@ -533,11 +507,6 @@ MdsClientImpl::RefreshSession(const std::vector<PartitionTxId> &txIds,
|
|||
LOG(INFO) << "RefreshSession need update partition txid list: "
|
||||
<< response.DebugString();
|
||||
}
|
||||
if (enableSumInDir->load() && !response.enablesumindir()) {
|
||||
enableSumInDir->store(response.enablesumindir());
|
||||
LOG(INFO) << "update enableSumInDir to "
|
||||
<< response.enablesumindir();
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
|
@ -548,8 +517,6 @@ MdsClientImpl::RefreshSession(const std::vector<PartitionTxId> &txIds,
|
|||
FSStatusCode MdsClientImpl::GetLatestTxId(const GetLatestTxIdRequest& request,
|
||||
GetLatestTxIdResponse* response) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
VLOG(3) << "GetLatestTxId [request]: " << request.DebugString();
|
||||
mdsClientMetric_.getLatestTxId.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.getLatestTxId.latency);
|
||||
|
|
@ -585,8 +552,6 @@ FSStatusCode MdsClientImpl::GetLatestTxId(const GetLatestTxIdRequest& request,
|
|||
|
||||
FSStatusCode MdsClientImpl::CommitTx(const CommitTxRequest& request) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
VLOG(3) << "CommitTx [request]: " << request.DebugString();
|
||||
mdsClientMetric_.commitTx.qps.count << 1;
|
||||
LatencyUpdater updater(&mdsClientMetric_.commitTx.latency);
|
||||
|
|
@ -705,8 +670,6 @@ SpaceErrCode MdsClientImpl::AllocateVolumeBlockGroup(
|
|||
const std::string &owner,
|
||||
std::vector<curvefs::mds::space::BlockGroup> *groups) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
AllocateBlockGroupResponse response;
|
||||
mdsbasecli_->AllocateVolumeBlockGroup(fsId, count, owner, &response,
|
||||
cntl, channel);
|
||||
|
|
@ -742,8 +705,6 @@ SpaceErrCode MdsClientImpl::AcquireVolumeBlockGroup(
|
|||
const std::string &owner,
|
||||
curvefs::mds::space::BlockGroup *groups) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
AcquireBlockGroupResponse response;
|
||||
mdsbasecli_->AcquireVolumeBlockGroup(fsId, blockGroupOffset, owner,
|
||||
&response, cntl, channel);
|
||||
|
|
@ -769,8 +730,6 @@ SpaceErrCode MdsClientImpl::ReleaseVolumeBlockGroup(
|
|||
const std::string &owner,
|
||||
const std::vector<curvefs::mds::space::BlockGroup> &blockGroups) {
|
||||
auto task = RPCTask {
|
||||
(void)addrindex;
|
||||
(void)rpctimeoutMS;
|
||||
ReleaseBlockGroupResponse response;
|
||||
mdsbasecli_->ReleaseVolumeBlockGroup(fsId, owner, blockGroups,
|
||||
&response, cntl, channel);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue