From: Greg Farnum Date: Tue, 14 Jul 2009 20:01:08 +0000 (-0700) Subject: client: new mkdirs command, and debugging output. X-Git-Tag: v0.11~86 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ad94b194786fed2cb205f83908e12bcbfac822a9;p=ceph.git client: new mkdirs command, and debugging output. Will create a all necessary directories for a filepath, not just the last one. --- diff --git a/src/client/Client.cc b/src/client/Client.cc index affdcfb23581..d3ab86235cac 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2912,17 +2912,58 @@ int Client::mkdir(const char *relpath, mode_t mode) tout << "mkdir" << std::endl; tout << relpath << std::endl; tout << mode << std::endl; + dout(10) << "mkdir: " << relpath << dendl; filepath path(relpath); + dout(10) << "mkdir: constructed filepath: " << path.get_path() << dendl; string name = path.last_dentry(); + dout(10) << "mkdir: got name from path.last_dentry()" << dendl; path.pop_dentry(); + dout(10) << "mkdir: popped dentry" << dendl; Inode *dir; + dout(10) << "mkdir: calling path_walk" << dendl; int r = path_walk(path, &dir); - if (r < 0) + if (r < 0) { + dout(10) << "mkdir: path_walk returned error: " << r << dendl; return r; + } + dout(10) << "mkdir: path_walked successfully" << dendl; return _mkdir(dir, name.c_str(), mode); } +int Client::mkdirs(const char *relpath, mode_t mode) +{ + Mutex::Locker lock(client_lock); + tout << "mkdirs" << std::endl; + tout << relpath << std::endl; + tout << mode << std::endl; + + filepath path(relpath); + unsigned int i; + int r; + Inode *cur = cwd; + Inode *next; + for (i=0; (r=_lookup(cur, path[i].c_str(), &next))==0 && iset_filepath(path); req->head.args.mkdir.mode = mode; + dout(10) << "_mkdir: making request" << dendl; int res = make_request(req, uid, gid); dout(10) << "mkdir result is " << res << dendl; diff --git a/src/client/Client.h b/src/client/Client.h index 9703f7648b9e..be6ecf6fe0be 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -1080,6 +1080,7 @@ public: // dirs int mkdir(const char *path, mode_t mode); + int mkdirs(const char *path, mode_t mode); int rmdir(const char *path); // symlinks