diff --git a/curvefs/src/client/fuse_client.cpp b/curvefs/src/client/fuse_client.cpp index 9be5048ec0..6f1c0b4771 100644 --- a/curvefs/src/client/fuse_client.cpp +++ b/curvefs/src/client/fuse_client.cpp @@ -41,14 +41,14 @@ #include "curvefs/src/client/filesystem/xattr.h" #include "curvefs/src/client/fuse_common.h" #include "curvefs/src/client/inode_wrapper.h" +#include "curvefs/src/client/rpcclient/fsdelta_updater.h" +#include "curvefs/src/client/rpcclient/fsquota_checker.h" #include "curvefs/src/client/warmup/warmup_manager.h" #include "curvefs/src/client/xattr_manager.h" #include "curvefs/src/common/define.h" #include "src/client/client_common.h" #include "src/common/dummyserver.h" #include "src/common/net_common.h" -#include "curvefs/src/client/rpcclient/fsdelta_updater.h" -#include "curvefs/src/client/rpcclient/fsquota_checker.h" #define PORT_LIMIT 65535 diff --git a/curvefs/src/client/rpcclient/fsquota_checker.cpp b/curvefs/src/client/rpcclient/fsquota_checker.cpp index d66d5cb354..7a619bc1c4 100644 --- a/curvefs/src/client/rpcclient/fsquota_checker.cpp +++ b/curvefs/src/client/rpcclient/fsquota_checker.cpp @@ -15,6 +15,7 @@ */ #include "curvefs/src/client/rpcclient/fsquota_checker.h" + #include "curvefs/src/client/rpcclient/fsdelta_updater.h" namespace curvefs { diff --git a/curvefs/src/client/rpcclient/mds_client.cpp b/curvefs/src/client/rpcclient/mds_client.cpp index cbb37fc01e..3c52bf3a5a 100644 --- a/curvefs/src/client/rpcclient/mds_client.cpp +++ b/curvefs/src/client/rpcclient/mds_client.cpp @@ -20,15 +20,16 @@ * Author: lixiaocui */ +#include "curvefs/src/client/rpcclient/mds_client.h" + #include #include #include #include "curvefs/proto/space.pb.h" -#include "curvefs/src/client/rpcclient/mds_client.h" -#include "curvefs/src/common/metric_utils.h" #include "curvefs/src/client/rpcclient/fsdelta_updater.h" #include "curvefs/src/client/rpcclient/fsquota_checker.h" +#include "curvefs/src/common/metric_utils.h" namespace curvefs { namespace client { @@ -516,7 +517,8 @@ MdsClientImpl::RefreshSession(const std::vector &txIds, request.set_fsname(fsName); *request.mutable_mountpoint() = mountpoint; curvefs::mds::FsDelta fsDelta; - fsDelta.set_bytes(FsDeltaUpdater::GetInstance().GetDeltaBytesAndReset()); + fsDelta.set_bytes( + FsDeltaUpdater::GetInstance().GetDeltaBytesAndReset()); *request.mutable_fsdelta() = std::move(fsDelta); mdsbasecli_->RefreshSession(request, &response, cntl, channel); diff --git a/curvefs/src/client/s3/client_s3_adaptor.cpp b/curvefs/src/client/s3/client_s3_adaptor.cpp index 5b778f96c5..cf3fa56796 100644 --- a/curvefs/src/client/s3/client_s3_adaptor.cpp +++ b/curvefs/src/client/s3/client_s3_adaptor.cpp @@ -30,9 +30,9 @@ #include #include "absl/memory/memory.h" -#include "curvefs/src/common/s3util.h" #include "curvefs/src/client/rpcclient/fsdelta_updater.h" #include "curvefs/src/client/rpcclient/fsquota_checker.h" +#include "curvefs/src/common/s3util.h" namespace curvefs { namespace client { diff --git a/curvefs/src/mds/codec/codec.cpp b/curvefs/src/mds/codec/codec.cpp index edfcac7204..3bee130c98 100644 --- a/curvefs/src/mds/codec/codec.cpp +++ b/curvefs/src/mds/codec/codec.cpp @@ -31,14 +31,14 @@ namespace curvefs { namespace mds { namespace codec { +using ::curve::common::EncodeBigEndian; +using ::curve::common::EncodeBigEndian_uint32; +using ::curvefs::mds::BLOCKGROUP_KEY_END; +using ::curvefs::mds::BLOCKGROUP_KEY_PREFIX; using ::curvefs::mds::COMMON_PREFIX_LENGTH; using ::curvefs::mds::FS_NAME_KEY_PREFIX; -using ::curvefs::mds::BLOCKGROUP_KEY_PREFIX; -using ::curvefs::mds::BLOCKGROUP_KEY_END; -using ::curvefs::mds::FS_USAGE_KEY_PREFIX; using ::curvefs::mds::FS_USAGE_KEY_END; -using ::curve::common::EncodeBigEndian; -using ::curve::common::EncodeBigEndian_uint32; +using ::curvefs::mds::FS_USAGE_KEY_PREFIX; std::string EncodeFsName(const std::string& fsName) { std::string key; diff --git a/curvefs/src/mds/fs_manager.cpp b/curvefs/src/mds/fs_manager.cpp index 8058fd0155..1fafbb1a1b 100644 --- a/curvefs/src/mds/fs_manager.cpp +++ b/curvefs/src/mds/fs_manager.cpp @@ -896,8 +896,8 @@ void FsManager::GetAllFsInfo( LOG(INFO) << "get all fsinfo."; } -FSStatusCode FsManager::UpdateFsUsedBytes(const std::string& fsName, - int64_t deltaBytes) { +FSStatusCode FsManager::UpdateFsUsedBytes( + const std::string& fsName, int64_t deltaBytes) { WriteLockGuard wlock(fsUsageMutex_); FsUsage usage; diff --git a/curvefs/src/mds/fs_manager.h b/curvefs/src/mds/fs_manager.h index 56a941dcaa..c7803657a3 100644 --- a/curvefs/src/mds/fs_manager.h +++ b/curvefs/src/mds/fs_manager.h @@ -253,8 +253,8 @@ class FsManager { bool TestS3(const std::string& fsName); - FSStatusCode UpdateFsUsedBytes(const std::string& fsName, - int64_t deltaBytes); + FSStatusCode UpdateFsUsedBytes( + const std::string& fsName, int64_t deltaBytes); private: std::shared_ptr fsStorage_; diff --git a/curvefs/src/mds/fs_storage.cpp b/curvefs/src/mds/fs_storage.cpp index cbe4bf3d79..304e2a30f5 100644 --- a/curvefs/src/mds/fs_storage.cpp +++ b/curvefs/src/mds/fs_storage.cpp @@ -159,15 +159,15 @@ void MemoryFsStorage::GetAll(std::vector* fsInfoVec) { } } -FSStatusCode MemoryFsStorage::SetFsUsage(const std::string& fsName, - const FsUsage& fsUsage) { +FSStatusCode MemoryFsStorage::SetFsUsage( + const std::string& fsName, const FsUsage& fsUsage) { WriteLockGuard writeLockGuard(fsUsedUsageLock_); fsUsageMap_[fsName] = fsUsage; return FSStatusCode::OK; } -FSStatusCode MemoryFsStorage::GetFsUsage(const std::string& fsName, - FsUsage* usage, bool fromCache) { +FSStatusCode MemoryFsStorage::GetFsUsage( + const std::string& fsName, FsUsage* usage, bool fromCache) { ReadLockGuard readLockGuard(fsUsedUsageLock_); auto it = fsUsageMap_.find(fsName); if (it == fsUsageMap_.end()) { @@ -502,8 +502,8 @@ void PersisKVStorage::GetAll(std::vector* fsInfoVec) { } } -FSStatusCode PersisKVStorage::SetFsUsage(const std::string& fsName, - const FsUsage& usage) { +FSStatusCode PersisKVStorage::SetFsUsage( + const std::string& fsName, const FsUsage& usage) { std::string key = codec::EncodeFsUsageKey(fsName); std::string value; if (!codec::EncodeProtobufMessage(usage, &value)) { @@ -521,8 +521,8 @@ FSStatusCode PersisKVStorage::SetFsUsage(const std::string& fsName, return FSStatusCode::OK; } -FSStatusCode PersisKVStorage::GetFsUsage(const std::string& fsName, - FsUsage* usage, bool fromCache) { +FSStatusCode PersisKVStorage::GetFsUsage( + const std::string& fsName, FsUsage* usage, bool fromCache) { if (fromCache) { ReadLockGuard lock(fsUsageCacheMutex_); if (fsUsageCache_.find(fsName) != fsUsageCache_.end()) { diff --git a/curvefs/src/mds/fs_storage.h b/curvefs/src/mds/fs_storage.h index 7891dadf70..d2ed8d674d 100644 --- a/curvefs/src/mds/fs_storage.h +++ b/curvefs/src/mds/fs_storage.h @@ -71,10 +71,10 @@ class FsStorage { virtual uint64_t NextFsId() = 0; virtual void GetAll(std::vector* fsInfoVec) = 0; - virtual FSStatusCode SetFsUsage(const std::string& fsName, - const FsUsage& usage) = 0; - virtual FSStatusCode GetFsUsage(const std::string& fsName, FsUsage* fsUsage, - bool fromCache) = 0; + virtual FSStatusCode SetFsUsage( + const std::string& fsName, const FsUsage& usage) = 0; + virtual FSStatusCode GetFsUsage( + const std::string& fsName, FsUsage* fsUsage, bool fromCache) = 0; virtual FSStatusCode DeleteFsUsage(const std::string& fsName) = 0; }; @@ -176,10 +176,10 @@ class MemoryFsStorage : public FsStorage { */ void GetAll(std::vector* fsInfoVec) override; - FSStatusCode SetFsUsage(const std::string& fsName, - const FsUsage& usage) override; - FSStatusCode GetFsUsage(const std::string& fsName, FsUsage*, - bool fromCache) override; + FSStatusCode SetFsUsage( + const std::string& fsName, const FsUsage& usage) override; + FSStatusCode GetFsUsage( + const std::string& fsName, FsUsage*, bool fromCache) override; FSStatusCode DeleteFsUsage(const std::string& fsName) override; private: @@ -219,10 +219,10 @@ class PersisKVStorage : public FsStorage { void GetAll(std::vector* fsInfoVec) override; - FSStatusCode SetFsUsage(const std::string& fsName, - const FsUsage& usage) override; - FSStatusCode GetFsUsage(const std::string& fsName, FsUsage*, - bool fromCache) override; + FSStatusCode SetFsUsage( + const std::string& fsName, const FsUsage& usage) override; + FSStatusCode GetFsUsage( + const std::string& fsName, FsUsage*, bool fromCache) override; FSStatusCode DeleteFsUsage(const std::string& fsName) override; private: diff --git a/curvefs/src/tools/curvefs_tool_define.cpp b/curvefs/src/tools/curvefs_tool_define.cpp index a162aef222..383479fba5 100644 --- a/curvefs/src/tools/curvefs_tool_define.cpp +++ b/curvefs/src/tools/curvefs_tool_define.cpp @@ -77,7 +77,7 @@ DEFINE_uint64(s3_chunksize, 4194304, "s3 chunk size"); DEFINE_uint32(s3_objectPrefix, 0, "object prefix"); DEFINE_bool(enableSumInDir, false, "statistic info in xattr"); DEFINE_uint64(capacity, (uint64_t)0, - "capacity of fs, unit is bytes, default 0 to disable quota"); + "capacity of fs, unit is bytes, default 0 to disable quota"); DEFINE_string(user, "anonymous", "user of request"); DEFINE_string(inodeId, "1,2,3", "inodes id"); diff --git a/curvefs/test/client/test_fuse_s3_client.cpp b/curvefs/test/client/test_fuse_s3_client.cpp index 7608410668..dd71313917 100644 --- a/curvefs/test/client/test_fuse_s3_client.cpp +++ b/curvefs/test/client/test_fuse_s3_client.cpp @@ -3941,12 +3941,12 @@ TEST_F(TestFuseS3Client, FuseOpUnlink_EnableSummary) { EXPECT_CALL(*inodeManager_, GetInode(_, _)) .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))) - .WillOnce(DoAll(SetArgReferee<1>(parentInodeWrapper), - Return(CURVEFS_ERROR::OK))) + .WillOnce(DoAll( + SetArgReferee<1>(parentInodeWrapper), Return(CURVEFS_ERROR::OK))) .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))) - .WillOnce(DoAll(SetArgReferee<1>(parentInodeWrapper), - Return(CURVEFS_ERROR::OK))); + .WillOnce(DoAll( + SetArgReferee<1>(parentInodeWrapper), Return(CURVEFS_ERROR::OK))); EXPECT_CALL(*metaClient_, GetInodeAttr(_, _, _)) .WillOnce(DoAll(SetArgPointee<2>(attr), Return(MetaStatusCode::OK))); EXPECT_CALL(*metaClient_, UpdateInodeAttr(_, _, _)) diff --git a/curvefs/test/client/test_fuse_volume_client.cpp b/curvefs/test/client/test_fuse_volume_client.cpp index 9bc32562e2..7f89072c6f 100644 --- a/curvefs/test/client/test_fuse_volume_client.cpp +++ b/curvefs/test/client/test_fuse_volume_client.cpp @@ -571,8 +571,8 @@ TEST_F(TestFuseVolumeClient, FuseOpUnlink) { EXPECT_CALL(*inodeManager_, GetInode(_, _)) .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))) - .WillOnce(DoAll(SetArgReferee<1>(parentInodeWrapper), - Return(CURVEFS_ERROR::OK))) + .WillOnce(DoAll( + SetArgReferee<1>(parentInodeWrapper), Return(CURVEFS_ERROR::OK))) .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))); EXPECT_CALL(*metaClient_, GetInodeAttr(_, _, _)) @@ -634,8 +634,8 @@ TEST_F(TestFuseVolumeClient, FuseOpRmDir) { EXPECT_CALL(*inodeManager_, GetInode(_, _)) .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))) - .WillOnce(DoAll(SetArgReferee<1>(parentInodeWrapper), - Return(CURVEFS_ERROR::OK))) + .WillOnce(DoAll( + SetArgReferee<1>(parentInodeWrapper), Return(CURVEFS_ERROR::OK))) .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))); EXPECT_CALL(*metaClient_, GetInodeAttr(_, _, _)) @@ -701,13 +701,13 @@ TEST_F(TestFuseVolumeClient, FuseOpUnlinkFailed) { EXPECT_CALL(*inodeManager_, GetInode(_, _)) .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))) - .WillOnce(DoAll(SetArgReferee<1>(parentInodeWrapper), - Return(CURVEFS_ERROR::OK))) + .WillOnce(DoAll( + SetArgReferee<1>(parentInodeWrapper), Return(CURVEFS_ERROR::OK))) .WillOnce(Return(CURVEFS_ERROR::INTERNAL)) .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))) - .WillOnce(DoAll(SetArgReferee<1>(parentInodeWrapper), - Return(CURVEFS_ERROR::OK))) + .WillOnce(DoAll( + SetArgReferee<1>(parentInodeWrapper), Return(CURVEFS_ERROR::OK))) .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))); EXPECT_CALL(*metaClient_, GetInodeAttr(_, _, _)) diff --git a/curvefs/test/mds/mock/mock_fs_stroage.h b/curvefs/test/mds/mock/mock_fs_stroage.h index 0414f70ff5..c3d08e4ea9 100644 --- a/curvefs/test/mds/mock/mock_fs_stroage.h +++ b/curvefs/test/mds/mock/mock_fs_stroage.h @@ -58,8 +58,8 @@ class MockFsStorage : public FsStorage { MOCK_METHOD0(NextFsId, uint64_t()); MOCK_METHOD1(GetAll, void(std::vector* fsInfoVec)); MOCK_METHOD2(SetFsUsage, FSStatusCode(const std::string&, const FsUsage&)); - MOCK_METHOD3(GetFsUsage, - FSStatusCode(const std::string&, FsUsage*, bool fromCache)); + MOCK_METHOD3( + GetFsUsage, FSStatusCode(const std::string&, FsUsage*, bool fromCache)); MOCK_METHOD1(DeleteFsUsage, FSStatusCode(const std::string&)); };