Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[style] Clean up warnings in code compilation #2383

Merged
merged 1 commit into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion curvefs/src/client/fuse_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ void FuseClient::Fini() {

CURVEFS_ERROR FuseClient::FuseOpInit(void *userdata,
struct fuse_conn_info *conn) {
(void)userdata;
(void)conn;
return CURVEFS_ERROR::OK;
}

Expand Down Expand Up @@ -253,6 +255,7 @@ void GetDentryParamFromInodeAttr(

CURVEFS_ERROR FuseClient::FuseOpLookup(fuse_req_t req, fuse_ino_t parent,
const char *name, fuse_entry_param *e) {
(void)req;
VLOG(1) << "FuseOpLookup parent: " << parent
<< ", name: " << name;
if (strlen(name) > option_.maxNameLength) {
Expand Down Expand Up @@ -285,6 +288,7 @@ CURVEFS_ERROR FuseClient::FuseOpLookup(fuse_req_t req, fuse_ino_t parent,

CURVEFS_ERROR FuseClient::FuseOpOpen(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi) {
(void)req;
VLOG(1) << "FuseOpOpen, ino: " << ino;
std::shared_ptr<InodeWrapper> inodeWrapper;
CURVEFS_ERROR ret = inodeManager_->GetInode(ino, inodeWrapper);
Expand Down Expand Up @@ -674,6 +678,7 @@ CURVEFS_ERROR FuseClient::GetOrCreateRecycleDir(fuse_req_t req, Dentry *out) {

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);
Expand Down Expand Up @@ -810,6 +815,7 @@ CURVEFS_ERROR FuseClient::RemoveNode(fuse_req_t req, fuse_ino_t parent,

CURVEFS_ERROR FuseClient::FuseOpOpenDir(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi) {
(void)req;
VLOG(1) << "FuseOpOpenDir ino = " << ino;
std::shared_ptr<InodeWrapper> inodeWrapper;
CURVEFS_ERROR ret = inodeManager_->GetInode(ino, inodeWrapper);
Expand All @@ -829,6 +835,7 @@ CURVEFS_ERROR FuseClient::FuseOpOpenDir(fuse_req_t req, fuse_ino_t ino,

CURVEFS_ERROR FuseClient::FuseOpReleaseDir(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi) {
(void)req;
uint64_t dindex = fi->fh;
VLOG(1) << "FuseOpReleaseDir, ino: " << ino << ", dindex: " << dindex;
dirBuf_->DirBufferRelease(dindex);
Expand Down Expand Up @@ -924,7 +931,7 @@ CURVEFS_ERROR FuseClient::FuseOpReadDirPlus(fuse_req_t req, fuse_ino_t ino,
bufHead->wasRead = true;
}

if (off < bufHead->size) {
if (off < static_cast<ssize_t>(bufHead->size)) {
*buffer = bufHead->p + off;
*rSize = std::min(bufHead->size - off, size);
} else {
Expand All @@ -937,6 +944,7 @@ CURVEFS_ERROR FuseClient::FuseOpReadDirPlus(fuse_req_t req, fuse_ino_t ino,
CURVEFS_ERROR FuseClient::FuseOpRename(fuse_req_t req, fuse_ino_t parent,
const char *name, fuse_ino_t newparent,
const char *newname) {
(void)req;
VLOG(1) << "FuseOpRename from (" << parent << ", " << name << ") to ("
<< newparent << ", " << newname << ")";
if (strlen(name) > option_.maxNameLength ||
Expand Down Expand Up @@ -986,6 +994,8 @@ CURVEFS_ERROR FuseClient::FuseOpRename(fuse_req_t req, fuse_ino_t parent,
CURVEFS_ERROR FuseClient::FuseOpGetAttr(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi,
struct stat *attr) {
(void)req;
(void)fi;
VLOG(1) << "FuseOpGetAttr ino = " << ino;
InodeAttr inodeAttr;
CURVEFS_ERROR ret =
Expand All @@ -1003,6 +1013,8 @@ CURVEFS_ERROR FuseClient::FuseOpSetAttr(fuse_req_t req, fuse_ino_t ino,
struct stat *attr, int to_set,
struct fuse_file_info *fi,
struct stat *attrOut) {
(void)req;
(void)fi;
VLOG(1) << "FuseOpSetAttr to_set: " << to_set << ", ino: " << ino
<< ", attr: " << *attr;
std::shared_ptr<InodeWrapper> inodeWrapper;
Expand Down Expand Up @@ -1095,6 +1107,7 @@ CURVEFS_ERROR FuseClient::FuseOpSetAttr(fuse_req_t req, fuse_ino_t ino,
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_.disableXattr) {
Expand Down Expand Up @@ -1134,6 +1147,8 @@ CURVEFS_ERROR FuseClient::FuseOpGetXattr(fuse_req_t req, fuse_ino_t ino,
CURVEFS_ERROR FuseClient::FuseOpSetXattr(fuse_req_t req, fuse_ino_t ino,
const char* name, const char* value,
size_t size, int flags) {
(void)req;
(void)flags;
if (option_.disableXattr) {
return CURVEFS_ERROR::NOTSUPPORT;
}
Expand Down Expand Up @@ -1173,6 +1188,7 @@ 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);
Expand Down Expand Up @@ -1301,6 +1317,7 @@ CURVEFS_ERROR FuseClient::FuseOpLink(fuse_req_t req, fuse_ino_t ino,
fuse_ino_t newparent, const char *newname,
FsFileType type,
fuse_entry_param *e) {
(void)req;
if (strlen(newname) > option_.maxNameLength) {
return CURVEFS_ERROR::NAMETOOLONG;
}
Expand Down Expand Up @@ -1370,6 +1387,7 @@ CURVEFS_ERROR FuseClient::FuseOpLink(fuse_req_t req, fuse_ino_t ino,

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);
Expand All @@ -1384,6 +1402,8 @@ CURVEFS_ERROR FuseClient::FuseOpReadLink(fuse_req_t req, fuse_ino_t ino,

CURVEFS_ERROR FuseClient::FuseOpRelease(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi) {
(void)req;
(void)fi;
VLOG(1) << "FuseOpRelease, ino: " << ino;
if (FLAGS_enableCto) {
inodeManager_->RemoveOpenedInode(ino);
Expand Down
17 changes: 11 additions & 6 deletions curvefs/src/client/fuse_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class FuseClient {
dentryManager_(std::make_shared<DentryCacheManagerImpl>(metaClient_)),
dirBuf_(std::make_shared<DirBuffer>()),
fsInfo_(nullptr),
mdsBase_(nullptr),
isStop_(true),
init_(false),
enableSumInDir_(false),
warmupManager_(nullptr) {}
warmupManager_(nullptr),
mdsBase_(nullptr),
isStop_(true) {}

virtual ~FuseClient() {}

Expand All @@ -112,11 +112,11 @@ class FuseClient {
dentryManager_(dentryManager),
dirBuf_(std::make_shared<DirBuffer>()),
fsInfo_(nullptr),
mdsBase_(nullptr),
isStop_(true),
init_(false),
enableSumInDir_(false),
warmupManager_(warmupManager) {}
warmupManager_(warmupManager),
mdsBase_(nullptr),
isStop_(true) {}

virtual CURVEFS_ERROR Init(const FuseClientOption &option);

Expand Down Expand Up @@ -221,11 +221,16 @@ 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;
Expand Down
6 changes: 3 additions & 3 deletions curvefs/src/client/fuse_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ extern "C" {
#endif

struct MountOption {
char* mountPoint;
char* fsName;
char* fsType;
const char* mountPoint;
const char* fsName;
const char* fsType;
char* conf;
char* mdsAddr;
};
Expand Down
8 changes: 7 additions & 1 deletion curvefs/src/client/fuse_s3_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ 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,
size_t *wSize) {
(void)req;
// check align
if (fi->flags & O_DIRECT) {
if (!(is_aligned(off, DirectIOAlignment) &&
Expand Down Expand Up @@ -214,6 +215,7 @@ 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) &&
Expand All @@ -232,7 +234,7 @@ CURVEFS_ERROR FuseS3Client::FuseOpRead(fuse_req_t req, fuse_ino_t ino,
uint64_t fileSize = inodeWrapper->GetLength();

size_t len = 0;
if (fileSize <= off) {
if (static_cast<int64_t>(fileSize) <= off) {
*rSize = 0;
return CURVEFS_ERROR::OK;
} else if (fileSize < off + size) {
Expand Down Expand Up @@ -306,6 +308,8 @@ 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);
Expand Down Expand Up @@ -334,6 +338,8 @@ 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;

Expand Down
8 changes: 8 additions & 0 deletions curvefs/src/client/fuse_volume_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ CURVEFS_ERROR FuseVolumeClient::FuseOpWrite(fuse_req_t req,
off_t off,
struct fuse_file_info *fi,
size_t *wSize) {
(void)req;
VLOG(9) << "write start, ino: " << ino << ", offset: " << off
<< ", length: " << size;

Expand Down Expand Up @@ -189,6 +190,7 @@ 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;

Expand Down Expand Up @@ -272,6 +274,8 @@ 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);
Expand All @@ -298,12 +302,16 @@ 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);
Expand Down
1 change: 1 addition & 0 deletions curvefs/src/client/inode_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ class UpdateInodeAsyncS3Done : public MetaServerClientDone {
} // namespace

void InodeWrapper::AsyncS3(MetaServerClientDone *done, bool internal) {
(void)internal;
if (dirty_ || !s3ChunkInfoAdd_.empty()) {
LockSyncingInode();
LockSyncingS3ChunkInfo();
Expand Down
6 changes: 3 additions & 3 deletions curvefs/src/client/inode_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class InodeWrapper : public std::enable_shared_from_this<InodeWrapper> {
InodeWrapper(Inode inode,
std::shared_ptr<MetaServerClient> metaClient,
std::shared_ptr<S3ChunkInfoMetric> s3ChunkInfoMetric = nullptr,
uint64_t maxDataSize = ULONG_MAX,
int64_t maxDataSize = LONG_MAX,
uint32_t refreshDataInterval = UINT_MAX)
: inode_(std::move(inode)),
status_(InodeStatus::kNormal),
Expand Down Expand Up @@ -400,8 +400,8 @@ class InodeWrapper : public std::enable_shared_from_this<InodeWrapper> {
InodeAttr dirtyAttr_;

InodeStatus status_;
uint64_t baseMaxDataSize_;
uint64_t maxDataSize_;
int64_t baseMaxDataSize_;
int64_t maxDataSize_;
uint32_t refreshDataInterval_;
uint64_t lastRefreshTime_;

Expand Down
2 changes: 1 addition & 1 deletion curvefs/src/client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void extra_options_help() {

std::string match_any_pattern(
const std::unordered_map<std::string, char**>& patterns, const char* src) {
int src_len = strlen(src);
size_t src_len = strlen(src);
for (const auto& pair : patterns) {
const auto& pattern = pair.first;
if (pattern.length() < src_len &&
Expand Down
1 change: 0 additions & 1 deletion curvefs/src/client/metric/client_metric.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ struct DiskCacheMetric {

struct KVClientMetric {
static const std::string prefix;

InterfaceMetric kvClientGet;
InterfaceMetric kvClientSet;

Expand Down
Loading