@@ -628,73 +628,6 @@ out_err:
return ret;
}
-/*
- * remove any client records that were not reclaimed since grace_start.
- */
-int
-sqlite_remove_unreclaimed(time_t grace_start)
-{
- int ret;
- char *err = NULL;
-
- ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld",
- grace_start);
- if (ret < 0) {
- return ret;
- } else if ((size_t)ret >= sizeof(buf)) {
- ret = -EINVAL;
- return ret;
- }
-
- ret = sqlite3_exec(dbh, buf, NULL, NULL, &err);
- if (ret != SQLITE_OK)
- xlog(L_ERROR, "%s: delete failed: %s", __func__, err);
-
- xlog(D_GENERAL, "%s: returning %d", __func__, ret);
- sqlite3_free(err);
- return ret;
-}
-
-/*
- * Are there any clients that are possibly still reclaiming? Return a positive
- * integer (usually number of clients) if so. If not, then return 0. On any
- * error, return non-zero.
- */
-int
-sqlite_query_reclaiming(const time_t grace_start)
-{
- int ret;
- sqlite3_stmt *stmt = NULL;
-
- ret = sqlite3_prepare_v2(dbh, "SELECT count(*) FROM clients WHERE "
- "time < ? OR has_session != 1", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- xlog(L_ERROR, "%s: unable to prepare select statement: %s",
- __func__, sqlite3_errmsg(dbh));
- return ret;
- }
-
- ret = sqlite3_bind_int64(stmt, 1, (sqlite3_int64)grace_start);
- if (ret != SQLITE_OK) {
- xlog(L_ERROR, "%s: bind int64 failed: %s",
- __func__, sqlite3_errmsg(dbh));
- return ret;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- xlog(L_ERROR, "%s: unexpected return code from select: %s",
- __func__, sqlite3_errmsg(dbh));
- return ret;
- }
-
- ret = sqlite3_column_int(stmt, 0);
- sqlite3_finalize(stmt);
- xlog(D_GENERAL, "%s: there are %d clients that have not completed "
- "reclaim", __func__, ret);
- return ret;
-}
-
int
sqlite_grace_start(void)
{
@@ -26,8 +26,6 @@ int sqlite_prepare_dbh(const char *topdir);
int sqlite_insert_client(const unsigned char *clname, const size_t namelen);
int sqlite_remove_client(const unsigned char *clname, const size_t namelen);
int sqlite_check_client(const unsigned char *clname, const size_t namelen);
-int sqlite_remove_unreclaimed(const time_t grace_start);
-int sqlite_query_reclaiming(const time_t grace_start);
int sqlite_grace_start(void);
int sqlite_grace_done(void);
int sqlite_iterate_recovery(int (*cb)(struct cld_client *clnt), struct cld_client *clnt);
Get rid of sqlite_query_reclaiming() and sqlite_remove_unreclaimed(), which are not used. Signed-off-by: Scott Mayhew <smayhew@redhat.com> --- utils/nfsdcld/sqlite.c | 67 ------------------------------------------ utils/nfsdcld/sqlite.h | 2 -- 2 files changed, 69 deletions(-)