Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5A88C32789 for ; Tue, 6 Nov 2018 18:36:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B5DE20827 for ; Tue, 6 Nov 2018 18:36:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B5DE20827 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388641AbeKGEDC (ORCPT ); Tue, 6 Nov 2018 23:03:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43146 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388663AbeKGECx (ORCPT ); Tue, 6 Nov 2018 23:02:53 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C54730820D3; Tue, 6 Nov 2018 18:36:20 +0000 (UTC) Received: from coeurl.usersys.redhat.com (ovpn-123-119.rdu2.redhat.com [10.10.123.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BAA61057044; Tue, 6 Nov 2018 18:36:20 +0000 (UTC) Received: by coeurl.usersys.redhat.com (Postfix, from userid 1000) id 31A532293A; Tue, 6 Nov 2018 13:36:20 -0500 (EST) From: Scott Mayhew 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 Message-Id: <20181106183620.18609-5-smayhew@redhat.com> In-Reply-To: <20181106183620.18609-1-smayhew@redhat.com> References: <20181106183620.18609-1-smayhew@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 06 Nov 2018 18:36:20 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Get rid of sqlite_query_reclaiming() and sqlite_remove_unreclaimed(), which are not used. Signed-off-by: Scott Mayhew --- 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