From patchwork Tue Sep 4 14:05:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Hrubis X-Patchwork-Id: 965939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 424TBC0vH4z9s7T for ; Wed, 5 Sep 2018 00:05:23 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id CD97B3E73E5 for ; Tue, 4 Sep 2018 16:05:19 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id 66F373E7074 for ; Tue, 4 Sep 2018 16:05:18 +0200 (CEST) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 492091000DC4 for ; Tue, 4 Sep 2018 16:05:16 +0200 (CEST) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6C124AFE7 for ; Tue, 4 Sep 2018 14:05:16 +0000 (UTC) From: Cyril Hrubis To: ltp@lists.linux.it Date: Tue, 4 Sep 2018 16:05:07 +0200 Message-Id: <20180904140507.30225-1-chrubis@suse.cz> X-Mailer: git-send-email 2.16.4 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.2 required=7.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Cc: Jan Kara Subject: [LTP] [PATCH] syscalls/statx01: Update the stx_blocks check X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" After talking with Jan Kara we decided that the previous check wasn't 100% right. * In some cases the data for small files can be stored along with the file metadata and in such case the number of allocated blocks would be zero. * I've been assured that the filesystem blocks size is <= than the optimal transfer block size and while the definition for stx_blksize is quite vague it should be good enough for the test. Note that we also rely on the fact that we write 256 bytes to the file, which is smaller than any known block size, so at most one block would be allocated. Signed-off-by: Cyril Hrubis CC: Jan Kara Acked-by: Jan Kara --- testcases/kernel/syscalls/statx/statx01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c index 806cea636..574560b5d 100644 --- a/testcases/kernel/syscalls/statx/statx01.c +++ b/testcases/kernel/syscalls/statx/statx01.c @@ -90,7 +90,7 @@ static void test_normal_file(void) buff.stx_mode, MODE); - if (buff.stx_blocks > 0 && buff.stx_blocks <= 128) + if (buff.stx_blocks <= buff.stx_blksize/512) tst_res(TPASS, "stx_blocks(%"PRIu64") is valid", buff.stx_blocks); else