From: Scott Mayhew <smayhew@redhat.com>
To: steved@redhat.com
Cc: bfields@fieldses.org, jlayton@kernel.org, linux-nfs@vger.kernel.org
Subject: [nfs-utils PATCH RFC v3 4/8] nfsdcld: remove some unused functions
Date: Tue, 26 Mar 2019 18:07:26 -0400 [thread overview]
Message-ID: <20190326220730.3763-5-smayhew@redhat.com> (raw)
In-Reply-To: <20190326220730.3763-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 82140ea..6e4eb66 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.2
next prev parent reply other threads:[~2019-03-26 22:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-26 22:07 [nfs-utils PATCH RFC v3 0/8] restore nfsdcld Scott Mayhew
2019-03-26 22:07 ` [nfs-utils PATCH RFC v3 1/8] Revert "nfsdcltrack: remove the nfsdcld daemon" Scott Mayhew
2019-03-26 22:07 ` [nfs-utils PATCH RFC v3 2/8] nfsdcld: move nfsdcld to its own directory Scott Mayhew
2019-03-26 22:07 ` [nfs-utils PATCH RFC v3 3/8] nfsdcld: a few enhancements Scott Mayhew
2019-03-26 22:07 ` Scott Mayhew [this message]
2019-03-26 22:07 ` [nfs-utils PATCH RFC v3 5/8] nfsdcld: the -p option should specify the rpc_pipefs mountpoint Scott Mayhew
2019-03-26 22:07 ` [nfs-utils PATCH RFC v3 6/8] nfsdcld: add /etc/nfs.conf support Scott Mayhew
2020-04-02 3:23 ` Yongcheng Yang
2019-03-26 22:07 ` [nfs-utils PATCH RFC v3 7/8] systemd: add a unit file for nfsdcld Scott Mayhew
2019-03-26 22:07 ` [nfs-utils PATCH RFC v3 8/8] nfsdcld: add a facility for migrating from older client tracking methods Scott Mayhew
2019-04-16 16:46 ` [nfs-utils PATCH RFC v3 0/8] restore nfsdcld J. Bruce Fields
2019-04-16 18:23 ` Steve Dickson
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=20190326220730.3763-5-smayhew@redhat.com \
--to=smayhew@redhat.com \
--cc=bfields@fieldses.org \
--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).