\fB[[!] --uid|-u|--user|-U <uname>|<uid>]
\fB<directory|filename>\fR
.br
-.B lfs osts
-.RB [ path ]
+.B lfs getname [-h]|[path ...]
.br
.B lfs getstripe [--obd|-O <uuid>] [--quiet|-q] [--verbose|-v]
\fB[--count | -c ] [--index | -i | --offset | -o ]
.br
.B lfs setstripe -d <dir>
.br
+.B lfs osts
+.RB [ path ]
+.br
.B lfs poollist <filesystem>[.<pool>] | <pathname>
.br
.B lfs quota [-q] [-v] [-o obd_uuid|-I ost_idx|-i mdt_idx] [-u <uname>| -u <uid>|-g <gname>| -g <gid>] <filesystem>
.B find
To search the directory tree rooted at the given dir/file name for the files that match the given parameters: \fB--atime\fR (file was last accessed N*24 hours ago), \fB--ctime\fR (file's status was last changed N*24 hours ago), \fB--mtime\fR (file's data was last modified N*24 hours ago), \fB--obd\fR (file has an object on a specific OST or OSTs), \fB--size\fR (file has size in bytes, or \fBk\fRilo-, \fBM\fRega-, \fBG\fRiga-, \fBT\fRera-, \fBP\fReta-, or \fBE\fRxabytes if a suffix is given), \fB--type\fR (file has the type: \fBb\fRlock, \fBc\fRharacter, \fBd\fRirectory, \fBp\fRipe, \fBf\fRile, sym\fBl\fRink, \fBs\fRocket, or \fBD\fRoor (Solaris)), \fB--uid\fR (file has specific numeric user ID), \fB--user\fR (file owned by specific user, numeric user ID allowed), \fB--gid\fR (file has specific group ID), \fB--group\fR (file belongs to specific group, numeric group ID allowed). The option \fB--maxdepth\fR limits find to decend at most N levels of directory tree. The options \fB--print\fR and \fB--print0\fR print full file name, followed by a newline or NUL character correspondingly. Using \fB!\fR before an option negates its meaning (\fIfiles NOT matching the parameter\fR). Using \fB+\fR before a numeric value means \fIfiles with the parameter OR MORE\fR, while \fB-\fR before a numeric value means \fIfiles with the parameter OR LESS\fR.
.TP
+.B getname [-h]|[path ...]
+Report all the Lustre mount points and the corresponding Lustre filesystem
+instance. If one or more \fBpath\fR entries are provided, then only the
+Lustre instance for these mount points is returned. If the path given is not on
+a Lustre instance 'No such device' is reported.
+.TP
.B osts
.RB [ path ]
List all the OSTs for all mounted filesystems. If a \fBpath\fR is provided
extern int llapi_search_mounts(const char *pathname, int index,
char *mntdir, char *fsname);
extern int llapi_search_fsname(const char *pathname, char *fsname);
+extern int llapi_getname(const char *path, char *buf, size_t size);
+
extern void llapi_ping_target(char *obd_type, char *obd_name,
char *obd_uuid, void *args);
#endif
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
int flags;
+
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),cmd=%x\n", inode->i_ino,
}
case OBD_IOC_FID2PATH:
RETURN(ll_fid2path(ll_i2mdexp(inode), (void *)arg));
-
case LL_IOC_GET_MDTIDX: {
int mdtidx;
RETURN(0);
}
+ case OBD_IOC_GETNAME: {
+ struct obd_device *obd =
+ class_exp2obd(ll_i2sbi(inode)->ll_dt_exp);
+ if (!obd)
+ RETURN(-EFAULT);
+ if (cfs_copy_to_user((void *)arg, obd->obd_name,
+ strlen(obd->obd_name) + 1))
+ RETURN(-EFAULT);
+ RETURN(0);
+ }
default: {
int err;
static int lfs_getstripe(int argc, char **argv);
static int lfs_osts(int argc, char **argv);
static int lfs_df(int argc, char **argv);
+static int lfs_getname(int argc, char **argv);
static int lfs_check(int argc, char **argv);
static int lfs_catinfo(int argc, char **argv);
#ifdef HAVE_SYS_QUOTA_H
"report filesystem disk space usage or inodes usage"
"of each MDS and all OSDs or a batch belonging to a specific pool .\n"
"Usage: df [-i] [-h] [--pool|-p <fsname>[.<pool>] [path]"},
+ {"getname", lfs_getname, 0, "list instances and specified mount points "
+ "[for specified path only]\n"
+ "Usage: getname [-h]|[path ...] "},
#ifdef HAVE_SYS_QUOTA_H
{"quotachown",lfs_quotachown, 0,
"Change files' owner or group on the specified filesystem.\n"
return rc;
}
+static int lfs_getname(int argc, char **argv)
+{
+ char mntdir[PATH_MAX] = "", path[PATH_MAX] = "", fsname[PATH_MAX] = "";
+ int rc = 0, index = 0, c;
+ char buf[sizeof(struct obd_uuid)];
+
+ optind = 0;
+ while ((c = getopt(argc, argv, "h")) != -1)
+ return CMD_HELP;
+
+ if (optind == argc) { /* no paths specified, get all paths. */
+ while (!llapi_search_mounts(path, index++, mntdir, fsname)) {
+ rc = llapi_getname(mntdir, buf, sizeof(buf));
+ if (rc < 0) {
+ fprintf(stderr,
+ "cannot get name for `%s': %s\n",
+ mntdir, strerror(-rc));
+ break;
+ }
+
+ printf("%s %s\n", buf, mntdir);
+
+ path[0] = fsname[0] = mntdir[0] = 0;
+ }
+ } else { /* paths specified, only attempt to search these. */
+ for (; optind < argc; optind++) {
+ rc = llapi_getname(argv[optind], buf, sizeof(buf));
+ if (rc < 0) {
+ fprintf(stderr,
+ "cannot get name for `%s': %s\n",
+ argv[optind], strerror(-rc));
+ break;
+ }
+
+ printf("%s %s\n", buf, argv[optind]);
+ }
+ }
+ return rc;
+}
+
static int lfs_check(int argc, char **argv)
{
int rc;
return rc;
}
+int llapi_getname(const char *path, char *buf, size_t size)
+{
+ struct obd_uuid uuid_buf;
+ char *uuid = uuid_buf.uuid;
+ int rc, nr;
+
+ memset(&uuid_buf, 0, sizeof(uuid_buf));
+ rc = llapi_file_get_lov_uuid(path, &uuid_buf);
+ if (rc)
+ return rc;
+
+ /* We want to turn lustre-clilov-ffff88002738bc00 into
+ * lustre-ffff88002738bc00. */
+
+ nr = snprintf(buf, size, "%.*s-%s",
+ (int) (strlen(uuid) - 24), uuid,
+ uuid + strlen(uuid) - 16);
+
+ if (nr >= size)
+ rc = -ENAMETOOLONG;
+
+ return rc;
+}
+
+
/* return the first file matching this pattern */
static int first_match(char *pattern, char *buffer)
{