From: Scott Mayhew <smayhew@redhat.com>
To: steved@redhat.com
Cc: jlayton@kernel.org, linux-nfs@vger.kernel.org
Subject: [nfs-utils PATCH RFC 4/7] nfsdcld: remove some unused functions
Date: Tue, 6 Nov 2018 13:36:17 -0500 [thread overview]
Message-ID: <20181106183620.18609-5-smayhew@redhat.com> (raw)
In-Reply-To: <20181106183620.18609-1-smayhew@redhat.com>
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(-)
diff --git a/utils/nfsdcld/sqlite.c b/utils/nfsdcld/sqlite.c
index 67549c9..71187f7 100644
--- a/utils/nfsdcld/sqlite.c
+++ b/utils/nfsdcld/sqlite.c
@@ -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)
{
diff --git a/utils/nfsdcld/sqlite.h b/utils/nfsdcld/sqlite.h
index 5c56f75..757e5cc 100644
--- a/utils/nfsdcld/sqlite.h
+++ b/utils/nfsdcld/sqlite.h
@@ -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);
--
2.17.1
next prev parent reply other threads:[~2018-11-06 18:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-06 18:36 [nfs-utils PATCH RFC 0/7] restore nfsdcld Scott Mayhew
2018-11-06 18:36 ` [nfs-utils PATCH RFC 1/7] Revert "nfsdcltrack: remove the nfsdcld daemon" Scott Mayhew
2018-11-06 18:36 ` [nfs-utils PATCH RFC 2/7] nfsdcld: move nfsdcld to its own directory Scott Mayhew
2018-11-06 18:36 ` [nfs-utils PATCH RFC 3/7] nfsdcld: a few enhancements Scott Mayhew
2018-11-10 14:16 ` Jeff Layton
2018-11-06 18:36 ` Scott Mayhew [this message]
2018-11-06 18:36 ` [nfs-utils PATCH RFC 5/7] nfsdcld: the -p option should specify the rpc_pipefs mountpoint Scott Mayhew
2018-11-06 18:36 ` [nfs-utils PATCH RFC 6/7] nfsdcld: add /etc/nfs.conf support Scott Mayhew
2018-11-08 12:00 ` Steve Dickson
2018-11-08 13:09 ` Scott Mayhew
2018-11-06 18:36 ` [nfs-utils PATCH RFC 7/7] systemd: add a unit file for nfsdcld Scott Mayhew
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181106183620.18609-5-smayhew@redhat.com \
--to=smayhew@redhat.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).