Whamcloud - gitweb
LU-1303 osd: support for forced sync in procfs
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Mon, 24 Sep 2012 15:00:48 +0000 (19:00 +0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Sep 2012 18:44:53 +0000 (14:44 -0400)
will be used by t-f to speedup file/object removals, etc.

Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Change-Id: Ic9d933b627eed0a47438b66890933ddc39cc8c8b
Reviewed-on: http://review.whamcloud.com/4083
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: wangdi <di.wang@whamcloud.com>
lustre/osd-ldiskfs/osd_lproc.c

index 6cb96a7..4e2cb99 100644 (file)
@@ -336,6 +336,27 @@ static int lprocfs_osd_rd_mntdev(char *page, char **start, off_t off, int count,
                        mnt_get_devname(osd->od_mnt));
 }
 
+static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
+                                    unsigned long count, void *data)
+{
+       struct osd_device *osd = osd_dt_dev(data);
+       struct dt_device  *dt = data;
+       struct lu_env      env;
+       int rc;
+
+       LASSERT(osd != NULL);
+       if (unlikely(osd->od_mnt == NULL))
+               return -EINPROGRESS;
+
+       rc = lu_env_init(&env, LCT_LOCAL);
+       if (rc)
+               return rc;
+       rc = dt_sync(&env, dt);
+       lu_env_fini(&env);
+
+       return rc == 0 ? count : rc;
+}
+
 #ifdef HAVE_LDISKFS_PDO
 static int lprocfs_osd_rd_pdo(char *page, char **start, off_t off, int count,
                               int *eof, void *data)
@@ -414,6 +435,7 @@ struct lprocfs_vars lprocfs_osd_obd_vars[] = {
         { "filesfree",       lprocfs_osd_rd_filesfree,   0, 0 },
         { "fstype",          lprocfs_osd_rd_fstype,      0, 0 },
         { "mntdev",          lprocfs_osd_rd_mntdev,      0, 0 },
+       { "force_sync",      0, lprocfs_osd_wr_force_sync     },
 #ifdef HAVE_LDISKFS_PDO
         { "pdo",             lprocfs_osd_rd_pdo, lprocfs_osd_wr_pdo, 0 },
 #endif