From patchwork Tue Sep 3 21:08:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 11128945 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8312D1813 for ; Tue, 3 Sep 2019 21:08:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C09D22CF8 for ; Tue, 3 Sep 2019 21:08:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727175AbfICVIW (ORCPT ); Tue, 3 Sep 2019 17:08:22 -0400 Received: from mga06.intel.com ([134.134.136.31]:32026 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbfICVIU (ORCPT ); Tue, 3 Sep 2019 17:08:20 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 14:08:20 -0700 X-IronPort-AV: E=Sophos;i="5.64,464,1559545200"; d="scan'208";a="207235905" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.157]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 14:08:19 -0700 From: ira.weiny@intel.com To: fstests@vger.kernel.org Cc: Ira Weiny Subject: [PATCH 1/3] src/locktest: Remove D_flag Date: Tue, 3 Sep 2019 14:08:13 -0700 Message-Id: <20190903210815.29545-2-ira.weiny@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190903210815.29545-1-ira.weiny@intel.com> References: <20190903210815.29545-1-ira.weiny@intel.com> MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Ira Weiny This flag is never set. Furthermore, there does not seem to be any need to set O_DIRECT for lock testing. Remove the D_flag Signed-off-by: Ira Weiny --- src/locktest.c | 41 +++++++---------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/src/locktest.c b/src/locktest.c index b23a1a99cc76..089951e2d992 100644 --- a/src/locktest.c +++ b/src/locktest.c @@ -61,8 +61,7 @@ extern int h_errno; #define HANDLE int #define INVALID_HANDLE -1 -#define OPEN(N,F) (open(N, F|O_CREAT|O_BINARY| \ - (D_flag ? O_DIRECT : 0), 0644)) +#define OPEN(N,F) (open(N, F|O_CREAT|O_BINARY, 0644)) #define SEEK(H, O) (lseek(H, O, SEEK_SET)) #define READ(H, B, L) (read(H, B, L)) #define WRITE(H, B, L) (write(H, B, L)) @@ -91,7 +90,6 @@ static SOCKET s_fd = -1; /* listen socket */ static SOCKET c_fd = -1; /* IPC socket */ static HANDLE f_fd = INVALID_HANDLE; /* shared file */ static char *buf; /* I/O buffer */ -static int D_flag = 0; #define WRLOCK 0 #define RDLOCK 1 @@ -579,12 +577,7 @@ initialize(HANDLE fd) int offset = 0; int togo = FILE_SIZE; - if (D_flag) { - ibuf = (char *)ALLOC_ALIGNED(INIT_BUFSZ); - } - else { - ibuf = (char*)malloc(INIT_BUFSZ); - } + ibuf = (char*)malloc(INIT_BUFSZ); memset(ibuf, ':', INIT_BUFSZ); SEEK(fd, 0L); @@ -614,15 +607,6 @@ int do_open(int flag) /*NOTREACHED*/ } -#ifdef __sun - if (D_flag) { - directio(f_fd, DIRECTIO_ON); - } -#elif defined(__APPLE__) - if (D_flag) { - fcntl(f_fd, F_NOCACHE, 1); - } -#endif return PASS; } @@ -826,18 +810,10 @@ main(int argc, char *argv[]) * +10 is slop for the iteration number if do_write() ... never * needed unless maxio is very small */ - if (D_flag) { - if ((buf = (char *)ALLOC_ALIGNED(maxio + 10)) == NULL) { - perror("aligned alloc buf"); - exit(1); - /*NOTREACHED*/ - } - } else { - if ((buf = (char *)malloc(maxio + 10)) == NULL) { - perror("malloc buf"); - exit(1); - /*NOTREACHED*/ - } + if ((buf = (char *)malloc(maxio + 10)) == NULL) { + perror("malloc buf"); + exit(1); + /*NOTREACHED*/ } setbuf(stderr, NULL); @@ -1159,10 +1135,7 @@ main(int argc, char *argv[]) printf("%d tests run, %d failed\n", test_count, fail_count); } if (buf) { - if (D_flag) - FREE_ALIGNED(buf); - else - free(buf); + free(buf); } From patchwork Tue Sep 3 21:08:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 11128943 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F37A17EF for ; Tue, 3 Sep 2019 21:08:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 184D522CF8 for ; Tue, 3 Sep 2019 21:08:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725962AbfICVIW (ORCPT ); Tue, 3 Sep 2019 17:08:22 -0400 Received: from mga03.intel.com ([134.134.136.65]:4267 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727175AbfICVIV (ORCPT ); Tue, 3 Sep 2019 17:08:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 14:08:20 -0700 X-IronPort-AV: E=Sophos;i="5.64,464,1559545200"; d="scan'208";a="189945989" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.157]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 14:08:20 -0700 From: ira.weiny@intel.com To: fstests@vger.kernel.org Cc: Ira Weiny Subject: [PATCH 2/3] src/locktest: Update test header comment Date: Tue, 3 Sep 2019 14:08:14 -0700 Message-Id: <20190903210815.29545-3-ira.weiny@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190903210815.29545-1-ira.weiny@intel.com> References: <20190903210815.29545-1-ira.weiny@intel.com> MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Ira Weiny The offset is also used as flags for the OPEN commands. Signed-off-by: Ira Weiny --- src/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locktest.c b/src/locktest.c index 089951e2d992..6030c7a8a909 100644 --- a/src/locktest.c +++ b/src/locktest.c @@ -175,7 +175,7 @@ char *descriptions[] = { }; static int64_t tests[][6] = - /* test # Action offset length expected server/client */ + /* test # Action [offset|flags] length expected server/client */ { /* Various simple tests exercising the list */ From patchwork Tue Sep 3 21:08:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 11128947 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B8C5F1398 for ; Tue, 3 Sep 2019 21:08:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 970FB22CF8 for ; Tue, 3 Sep 2019 21:08:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727061AbfICVIW (ORCPT ); Tue, 3 Sep 2019 17:08:22 -0400 Received: from mga14.intel.com ([192.55.52.115]:54692 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbfICVIW (ORCPT ); Tue, 3 Sep 2019 17:08:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 14:08:21 -0700 X-IronPort-AV: E=Sophos;i="5.64,464,1559545200"; d="scan'208";a="212143114" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.157]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 14:08:21 -0700 From: ira.weiny@intel.com To: fstests@vger.kernel.org Cc: Ira Weiny Subject: [PATCH 3/3] src/locktest: Remove unused buf allocation Date: Tue, 3 Sep 2019 14:08:15 -0700 Message-Id: <20190903210815.29545-4-ira.weiny@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190903210815.29545-1-ira.weiny@intel.com> References: <20190903210815.29545-1-ira.weiny@intel.com> MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Ira Weiny Signed-off-by: Ira Weiny --- src/locktest.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/locktest.c b/src/locktest.c index 6030c7a8a909..8e27e922668e 100644 --- a/src/locktest.c +++ b/src/locktest.c @@ -81,7 +81,6 @@ static char *prog; static char *filename = 0; static int debug = 0; static int server = 1; -static int maxio = 8192; static int port = 0; static int testnumber = -1; static int saved_errno = 0; @@ -89,7 +88,6 @@ static int saved_errno = 0; static SOCKET s_fd = -1; /* listen socket */ static SOCKET c_fd = -1; /* IPC socket */ static HANDLE f_fd = INVALID_HANDLE; /* shared file */ -static char *buf; /* I/O buffer */ #define WRLOCK 0 #define RDLOCK 1 @@ -806,16 +804,6 @@ main(int argc, char *argv[]) if (do_open(O_RDWR) == FAIL) exit(1); - /* - * +10 is slop for the iteration number if do_write() ... never - * needed unless maxio is very small - */ - if ((buf = (char *)malloc(maxio + 10)) == NULL) { - perror("malloc buf"); - exit(1); - /*NOTREACHED*/ - } - setbuf(stderr, NULL); if (server) { @@ -1134,10 +1122,6 @@ main(int argc, char *argv[]) if(server) printf("%d tests run, %d failed\n", test_count, fail_count); } - if (buf) { - free(buf); - } - exit(fail_count); /*NOTREACHED*/