Skip to content

Commit

Permalink
Remove duplicated log message
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhuaang committed Jun 20, 2018
1 parent 9eba688 commit 29f7e8d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 45 deletions.
8 changes: 0 additions & 8 deletions src/data/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ pair<size_t, ContentRangeDeque> File::Read(
shared_ptr<DirectoryTree> dirTree, shared_ptr<Cache> cache,
shared_ptr<Client> client, bool async) {
lock_guard<recursive_mutex> lock(m_mutex);
DebugInfo("[offset:" + to_string(offset) + ", len:" + to_string(len) + "] " +
FormatPath(GetFilePath()));
shared_ptr<Node> node = dirTree->Find(GetFilePath());
if (!node) {
Error("Not found node in directory tree " + FormatPath(GetFilePath()));
Expand Down Expand Up @@ -310,8 +308,6 @@ pair<size_t, ContentRangeDeque> File::Read(
pair<size_t, ContentRangeDeque> File::ReadNoLoad(off_t offset, size_t len,
char *buf) const {
lock_guard<recursive_mutex> lock(m_mutex);
DebugInfo("[offset:" + to_string(offset) + ", len:" + to_string(len) + "] " +
FormatPath(GetFilePath()));
if (buf != NULL) {
memset(buf, 0, len);
}
Expand Down Expand Up @@ -383,8 +379,6 @@ tuple<bool, size_t, size_t> File::Write(
off_t offset, size_t len, const char *buffer,
const shared_ptr<DirectoryTree> &dirTree, const shared_ptr<Cache> &cache) {
lock_guard<recursive_mutex> lock(m_mutex);
DebugInfo("[offset:" + to_string(offset) + ", len:" + to_string(len) + "] " +
FormatPath(GetFilePath()));
if (PreWrite(len, cache)) {
tuple<bool, size_t, size_t> res = DoWrite(offset, len, buffer);
bool success = boost::get<0>(res);
Expand All @@ -402,8 +396,6 @@ tuple<bool, size_t, size_t> File::Write(
off_t offset, size_t len, const shared_ptr<iostream> &stream,
const shared_ptr<DirectoryTree> &dirTree, const shared_ptr<Cache> &cache) {
lock_guard<recursive_mutex> lock(m_mutex);
DebugInfo("[offset:" + to_string(offset) + ", len:" + to_string(len) + "] " +
FormatPath(GetFilePath()));
if (PreWrite(len, cache)) {
tuple<bool, size_t, size_t> res = DoWrite(offset, len, stream);
bool success = boost::get<0>(res);
Expand Down
13 changes: 0 additions & 13 deletions src/filesystem/Drive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ struct RemoveFileCallback {
// --------------------------------------------------------------------------
// Remove a file or an empty directory
void Drive::RemoveFile(const string &filePath, bool async) {
DebugInfo(FormatPath(filePath));
RemoveFileCallback receivedHandler(filePath, m_directoryTree, m_cache);

if (async) { // delete file asynchronously
Expand Down Expand Up @@ -421,7 +420,6 @@ struct MakeFileCallback {

// --------------------------------------------------------------------------
void Drive::MakeFile(const string &filePath, mode_t mode, bool async) {
DebugInfo("[mode:" + QS::StringUtils::ModeToString(mode) +"]" + FormatPath(filePath));
FileType::Value type = FileType::File;
if (mode & S_IFREG) {
type = FileType::File;
Expand Down Expand Up @@ -482,7 +480,6 @@ struct MakeDirCallback {

// --------------------------------------------------------------------------
void Drive::MakeDir(const string &dirPath, mode_t mode, bool async) {
DebugInfo(FormatPath(dirPath));
MakeDirCallback receivedHandler(dirPath, m_directoryTree, m_client);
if (async) {
GetClient()->GetExecutor()->SubmitAsyncPrioritized(
Expand All @@ -497,7 +494,6 @@ void Drive::MakeDir(const string &dirPath, mode_t mode, bool async) {

// --------------------------------------------------------------------------
void Drive::OpenFile(const string &filePath, bool async) {
DebugInfo(FormatPath(filePath));
pair<shared_ptr<Node>, bool> res = GetNode(filePath, true, false, false);
shared_ptr<Node> node = res.first;

Expand All @@ -522,8 +518,6 @@ void Drive::OpenFile(const string &filePath, bool async) {
// --------------------------------------------------------------------------
size_t Drive::ReadFile(const string &filePath, off_t offset, size_t size,
char *buf, bool async) {
DebugInfo("Start read [offset:" + to_string(offset) +
", size:" + to_string(size) + "] " + FormatPath(filePath));
// read is only called if the file has been opend with the correct flags
// no need to head it for latest meta
shared_ptr<Node> node = GetNodeSimple(filePath);
Expand All @@ -550,7 +544,6 @@ size_t Drive::ReadFile(const string &filePath, off_t offset, size_t size,

// --------------------------------------------------------------------------
void Drive::ReadSymlink(const std::string &linkPath) {
DebugInfo(FormatPath(linkPath));
shared_ptr<Node> node = GetNodeSimple(linkPath);
shared_ptr<stringstream> buffer = make_shared<stringstream>();
ClientError<QSError::Value> err = GetClient()->DownloadFile(linkPath, buffer);
Expand Down Expand Up @@ -598,7 +591,6 @@ struct RenameFileCallback {

// --------------------------------------------------------------------------
void Drive::RenameFile(const string &filePath, const string &newFilePath, bool async) {
DebugInfo(FormatPath(filePath, newFilePath));
RenameFileCallback receivedHandler(filePath, newFilePath, m_directoryTree, m_cache);
if (async) {
GetClient()->GetExecutor()->SubmitAsyncPrioritized(
Expand Down Expand Up @@ -667,7 +659,6 @@ struct RenameDirCallback {
// --------------------------------------------------------------------------
void Drive::RenameDir(const string &dirPath, const string &newDirPath,
bool async) {
DebugInfo(FormatPath(dirPath, newDirPath));
// Do Renaming
RenameDirCallback receivedHandler(dirPath, newDirPath, m_directoryTree,
m_cache, this);
Expand All @@ -687,7 +678,6 @@ void Drive::RenameDir(const string &dirPath, const string &newDirPath,
// in the form of an absolute path (in qsfs) or relative path and that affects
// pathname resolution.
void Drive::SymLink(const string &filePath, const string &linkPath) {
DebugInfo(FormatPath(filePath, linkPath));
assert(!filePath.empty() && !linkPath.empty());
ClientError<QSError::Value> err = GetClient()->SymLink(filePath, linkPath);
if (!IsGoodQSError(err)) {
Expand Down Expand Up @@ -755,7 +745,6 @@ void Drive::FlushFile(const string &filePath, bool releaseFile, bool updateMeta,

// --------------------------------------------------------------------------
void Drive::ReleaseFile(const string &filePath) {
DebugInfo(FormatPath(filePath));
shared_ptr<Node> node = GetNodeSimple(filePath);

if (!(node && *node)) {
Expand Down Expand Up @@ -783,8 +772,6 @@ void Drive::Utimens(const string &path, time_t mtime) {
// --------------------------------------------------------------------------
int Drive::WriteFile(const string &filePath, off_t offset, size_t size,
const char *buf) {
DebugInfo("[offset:" + to_string(offset) + ", size:" + to_string(size) + "]" +
FormatPath(filePath));
shared_ptr<Node> node = GetNodeSimple(filePath);
if (!(node && *node)) {
Warning("File not exist " + FormatPath(filePath));
Expand Down
48 changes: 24 additions & 24 deletions src/filesystem/Operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void InitializeFUSECallbacks(struct fuse_operations* fuseOps) {
// Similar to stat(). The 'st_dev' and 'st_blksize' fields are ignored. The
// 'st_ino' filed is ignored except if the 'use_ino' mount option is given.
int qsfs_getattr(const char* path, struct stat* statbuf) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -360,7 +360,7 @@ int qsfs_getattr(const char* path, struct stat* statbuf) {
// The arguments is already verified
// Readlink is only called with an existing symlink.
int qsfs_readlink(const char* path, char* link, size_t size) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -430,7 +430,7 @@ int qsfs_readlink(const char* path, char* link, size_t size) {
// If the filesystem defines a create() method, then for regular files that
// will be called instead.
int qsfs_mknod(const char* path, mode_t mode, dev_t dev) {
Info(FormatPath(path));
DebugInfo("[mode:" + QS::StringUtils::ModeToString(mode) +"]" + FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -484,7 +484,7 @@ int qsfs_mknod(const char* path, mode_t mode, dev_t dev) {
// S_ISDIR(mode) can be false. To obtain the correct directory type bits use
// mode|S_IFDIR.
int qsfs_mkdir(const char* path, mode_t mode) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -535,7 +535,7 @@ int qsfs_mkdir(const char* path, mode_t mode) {
// --------------------------------------------------------------------------
// Remove a file
int qsfs_unlink(const char* path) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -582,7 +582,7 @@ int qsfs_unlink(const char* path) {
// --------------------------------------------------------------------------
// Remove a directory
int qsfs_rmdir(const char* path) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -643,7 +643,7 @@ int qsfs_rmdir(const char* path) {
// Symlink is only called if there isn't already another object with the
// requested linkname.
int qsfs_symlink(const char* path, const char* link) {
Info(FormatPath(path));
DebugInfo(FormatPath(path, link));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -700,7 +700,7 @@ int qsfs_symlink(const char* path, const char* link) {
// not overwrite new file name and return an error (ENOTEMPTY) instead.
// Otherwise, the filesystem will replace the new file name.
int qsfs_rename(const char* path, const char* newpath) {
Info(FormatPath(path, newpath));
DebugInfo(FormatPath(path, newpath));
if (!IsValidPath(path) || !IsValidPath(newpath)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -788,7 +788,7 @@ int qsfs_chmod(const char* path, mode_t mode) {
// fake this is implmented
// TODO<jim>: implement when skd ready
return 0;
Info("Change permisions to " + ModeToString(mode) + " for path" +
DebugInfo("Change permisions to " + ModeToString(mode) + " for path" +
FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
Expand Down Expand Up @@ -846,7 +846,7 @@ int qsfs_chown(const char* path, uid_t uid, gid_t gid) {
// fake this is implmented
// TODO<jim>: implement when skd ready
return 0;
Info("[uid=" + to_string(uid) + ", gid=" + to_string(gid) + "] " +
DebugInfo("[uid=" + to_string(uid) + ", gid=" + to_string(gid) + "] " +
FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
Expand Down Expand Up @@ -898,7 +898,7 @@ int qsfs_chown(const char* path, uid_t uid, gid_t gid) {
// --------------------------------------------------------------------------
// Change the size of a file
int qsfs_truncate(const char* path, off_t newsize) {
Info("[size=" + to_string(newsize) + "]" + FormatPath(path));
DebugInfo("[size=" + to_string(newsize) + "]" + FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -962,7 +962,7 @@ int qsfs_truncate(const char* path, off_t newsize) {
// filehandle in the fuse_file_info structure, which will be
// passed to all file operations.
int qsfs_open(const char* path, struct fuse_file_info* fi) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -1037,7 +1037,7 @@ int qsfs_open(const char* path, struct fuse_file_info* fi) {
// Read are only called if the file has been opend with the correct flags.
int qsfs_read(const char* path, char* buf, size_t size, off_t offset,
struct fuse_file_info* fi) {
Info("[offset:" + to_string(offset) + ", size:" + to_string(size) + "] " +
DebugInfo("[offset:" + to_string(offset) + ", size:" + to_string(size) + "] " +
FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
Expand Down Expand Up @@ -1100,8 +1100,8 @@ int qsfs_read(const char* path, char* buf, size_t size, off_t offset,
// Write is only called if the file has been opened with the correct flags.
int qsfs_write(const char* path, const char* buf, size_t size, off_t offset,
struct fuse_file_info* fi) {
Info("[size=" + to_string(size) +
"] [offset=" + to_string(offset) + "] " + FormatPath(path));
DebugInfo("[offset:" + to_string(offset) + ", size:" + to_string(size) + "] " +
FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
errno = EINVAL;
Expand Down Expand Up @@ -1149,7 +1149,7 @@ int qsfs_write(const char* path, const char* buf, size_t size, off_t offset,
//
// The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored.
int qsfs_statfs(const char* path, struct statvfs* statv) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -1198,7 +1198,7 @@ int qsfs_statfs(const char* path, struct statvfs* statv) {
// Filesystes shouldn't assume that flush will always be called after some
// writes, or that if will be called at all.
int qsfs_flush(const char* path, struct fuse_file_info* fi) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
int mask = O_RDONLY != (fi->flags & O_ACCMODE) ? W_OK : R_OK;
int ret = 0;
try {
Expand Down Expand Up @@ -1253,7 +1253,7 @@ int qsfs_flush(const char* path, struct fuse_file_info* fi) {
// than once, in which case only the last release will mean, that no more
// reads/writes will happen on the file.
int qsfs_release(const char* path, struct fuse_file_info* fi) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -1298,7 +1298,7 @@ int qsfs_release(const char* path, struct fuse_file_info* fi) {
// If the datasync parameter is non-zero, then only the user data should be
// flushed, not the meta data.
int qsfs_fsync(const char* path, int datasync, struct fuse_file_info* fi) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
int ret = 0;
try {
// Check whether path existing
Expand Down Expand Up @@ -1369,7 +1369,7 @@ int qsfs_removexattr(const char* path, const char* name) {
// return an arbitrary file handle in the fuse_file_info structure, which will
// be passed to readdir, closedir and fsyncdir.
int qsfs_opendir(const char* path, struct fuse_file_info* fi) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -1427,7 +1427,7 @@ int qsfs_opendir(const char* path, struct fuse_file_info* fi) {
// Readdir is only called with an existing directory name
int qsfs_readdir(const char* path, void* buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info* fi) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -1576,7 +1576,7 @@ void qsfs_destroy(void* userdata) {
//
// This method is not called under Linux kernel versions 2.4.x
int qsfs_access(const char* path, int mask) {
Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -1621,7 +1621,7 @@ int qsfs_access(const char* path, int mask) {
// If this method is not implemented or under Linux Kernal verions earlier
// than 2.6.15, the mknod() and open() methods will be called instead.
int qsfs_create(const char* path, mode_t mode, struct fuse_file_info* fi) {
Info( FormatPath(path));
DebugInfo( FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down Expand Up @@ -1714,7 +1714,7 @@ int qsfs_utimens(const char* path, const struct timespec tv[2]) {
// TODO<jim>: implement when skd ready
return 0;

Info(FormatPath(path));
DebugInfo(FormatPath(path));
if (!IsValidPath(path)) {
Error("Null path parameter from fuse");
return -EINVAL;
Expand Down

0 comments on commit 29f7e8d

Please sign in to comment.