Whamcloud - gitweb
LU-2074 build: fix 'copy into fixed size buffer' errors
[fs/lustre-release.git] / lustre / osp / lproc_osp.c
index 790500c..22e3372 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -291,7 +291,8 @@ static int osp_rd_prealloc_next_id(char *page, char **start, off_t off,
        if (osp == NULL)
                return 0;
 
-       return snprintf(page, count, LPU64"\n", osp->opd_pre_used_id + 1);
+       return snprintf(page, count, "%u\n",
+                       fid_oid(&osp->opd_pre_used_fid) + 1);
 }
 
 static int osp_rd_prealloc_last_id(char *page, char **start, off_t off,
@@ -303,7 +304,34 @@ static int osp_rd_prealloc_last_id(char *page, char **start, off_t off,
        if (osp == NULL)
                return 0;
 
-       return snprintf(page, count, LPU64"\n", osp->opd_pre_last_created);
+       return snprintf(page, count, "%u\n",
+                       fid_oid(&osp->opd_pre_last_created_fid));
+}
+
+static int osp_rd_prealloc_next_seq(char *page, char **start, off_t off,
+                                   int count, int *eof, void *data)
+{
+       struct obd_device *obd = data;
+       struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
+
+       if (osp == NULL)
+               return 0;
+
+       return snprintf(page, count, LPX64"\n",
+                       fid_seq(&osp->opd_pre_used_fid));
+}
+
+static int osp_rd_prealloc_last_seq(char *page, char **start, off_t off,
+                                   int count, int *eof, void *data)
+{
+       struct obd_device *obd = data;
+       struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
+
+       if (osp == NULL)
+               return 0;
+
+       return snprintf(page, count, LPX64"\n",
+                       fid_seq(&osp->opd_pre_last_created_fid));
 }
 
 static int osp_rd_prealloc_reserved(char *page, char **start, off_t off,
@@ -374,6 +402,9 @@ static int osp_rd_destroys_in_flight(char *page, char **start, off_t off,
        struct obd_device *dev = data;
        struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
 
+       if (osp == NULL)
+               return -EINVAL;
+
        /*
         * This counter used to determine if OST has space returned.
         * Now we need to wait for the following:
@@ -414,7 +445,9 @@ static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
        { "max_create_count",   osp_rd_max_create_count,
                                osp_wr_max_create_count, 0 },
        { "prealloc_next_id",   osp_rd_prealloc_next_id, 0, 0 },
-       { "prealloc_last_id",   osp_rd_prealloc_last_id, 0, 0 },
+       { "prealloc_next_seq",  osp_rd_prealloc_next_seq, 0, 0 },
+       { "prealloc_last_id",   osp_rd_prealloc_last_id,  0, 0 },
+       { "prealloc_last_seq",  osp_rd_prealloc_last_seq, 0, 0 },
        { "prealloc_reserved",  osp_rd_prealloc_reserved, 0, 0 },
        { "timeouts",           lprocfs_rd_timeouts, 0, 0 },
        { "import",             lprocfs_rd_import, lprocfs_wr_import, 0 },
@@ -432,12 +465,12 @@ static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
 };
 
 static struct lprocfs_vars lprocfs_osp_osd_vars[] = {
-       { "blocksize",          lprocfs_osd_rd_blksize, 0, 0 },
-       { "kbytestotal",        lprocfs_osd_rd_kbytestotal, 0, 0 },
-       { "kbytesfree",         lprocfs_osd_rd_kbytesfree, 0, 0 },
-       { "kbytesavail",        lprocfs_osd_rd_kbytesavail, 0, 0 },
-       { "filestotal",         lprocfs_osd_rd_filestotal, 0, 0 },
-       { "filesfree",          lprocfs_osd_rd_filesfree, 0, 0 },
+       { "blocksize",          lprocfs_dt_rd_blksize, 0, 0 },
+       { "kbytestotal",        lprocfs_dt_rd_kbytestotal, 0, 0 },
+       { "kbytesfree",         lprocfs_dt_rd_kbytesfree, 0, 0 },
+       { "kbytesavail",        lprocfs_dt_rd_kbytesavail, 0, 0 },
+       { "filestotal",         lprocfs_dt_rd_filestotal, 0, 0 },
+       { "filesfree",          lprocfs_dt_rd_filesfree, 0, 0 },
        { 0 }
 };