From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81F71394464 for ; Fri, 27 Feb 2026 18:31:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772217093; cv=none; b=fuoTiV4YOCQwltzLPdwjTh2BqJEm4g/NUHpLaCUAySkGgHDlO+4xSn7Zpndm0ImnzjUBJIiFxVIW7zCuz8pYol3ifDq/h5AdIMM1dRrRbHFpUryYpCKmoyENHqX+n3lS+QuX3sCHf72/CxJ0d7I3+TnRmMieVEKQMEihlfGVbfw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772217093; c=relaxed/simple; bh=oFS7a9tcfMBexhfcX+QtaKV/GkG5yXbkGgkChhRjGGk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kwlNi0PIG/+rir9YBYaqg0TKMWFMUHO6bvwFfhgBWn+PEA0TyszR9sYXjPXnChy9ljdScC2FFyZVhH99TxilSLoCj1nOYmbMnOXSUHyzl3ou99AazsW6ajR8xwgcZmhv3Lb3N+r9nSgOmkBTRCcs2SiU3G3HrLIlc6wsoOF4ke0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O65ZFQ5/; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O65ZFQ5/" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2adff872068so11955255ad.1 for ; Fri, 27 Feb 2026 10:31:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772217092; x=1772821892; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lE+SoT0tniCBmbDHvTQZN8k/uRnXafqmPKiJ44BTAzk=; b=O65ZFQ5/F2IhocwhAbTr+HHuEvZu2iNlhummjnshL9bdyCjMVTb6gNcFqqrpBi/hHm 6sB6F5kt7POISi0TSEZrLPMCo9H0nVK8l2us70ZeAoMCcP5sFg+UxKnvLMU4e+cpxWOY P5hRoQgFYam3HYfgLkCv4tYex8T6BA2833LeOanrkmCDYu1FFQUCAcX+9g4h34Z0UqxW EvMADCdGmJ1H0w02M3a+3YTPJBMcSAkZn7le1NloqmBAc90cjab3w0XK3XqtPS3uVfWf dN0pd73WZMviSa9PkLY4JpW7XCPl8DIcIKQ8RiA2R9L7WWYREZ1sxjtixe7ffrJ6VrjR FeAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772217092; x=1772821892; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lE+SoT0tniCBmbDHvTQZN8k/uRnXafqmPKiJ44BTAzk=; b=q2EIJWJCxKAKEhD9dwAbvQQV26gyZgj9exgYmpIls2XBoGa8SnkDFUuWEVn6ju8JJw 0nwtx0Lto3+72DqO8QbWK5HJV4/EUU++L7KaSsGbVSjvc0a4YzHFQFVxFdAwPU0d7dAd Wlt31EgbkdOaRjtDZ+i5vLqKjaYLhCl13wiYL5nPksqpamfMT8kb5hEyKbE3xSSOBfQw 8vUL566lt3fI4veQ0E3DkaSL4+g7URkoTAl3I/FDLDc9i+EQHVQ9weCOvjZCYH2Plauh vD8aWedT8UE4tfYgLVqOvJsR2tPNpOgbe4Ps5MuiYH7s2sf13xR+QyDcM/MmUyqVb4Bu 95nA== X-Forwarded-Encrypted: i=1; AJvYcCWqZGOX6NtdjPh+/AL9TDZdENvspEYdmIum7D58qGwmNtwehU0mzR+kpUJgBvGVz/yKKFeETYxgihXzFHM=@vger.kernel.org X-Gm-Message-State: AOJu0Yyi7bSkmJJCaDNxSYfxX4e2/1zSkjtaCaUx59OfeXIJH5sHBr27 BBrwbV3iX4onfTszO1TPgvF3PV+r4O7lJySImigXVPxGUaU8pmNtKlSb X-Gm-Gg: ATEYQzxI5xJg6GSbPkyJVepLYlx4r1PbHPWpMSEoFSgsjwebhB7F59WbpON6f9agRJy Hmb7DK/ifTGYa5stw+ZwEOR8gj+8pep8RllxVoVAHMtdIGiGF2jADTKs5VDE8W7pxtBrpokEDt7 R4ZAD62LNdzE1GGZ0PRjUZd6LFyLRZMTuD/2fKzcN12+PsvI7J5PWzgXLQW+dj+6SiOXvvSgleH 2+1WsrNlqrp+h0CmzfuJAp/OrQ4CFzIFpVrph0hJfuaGqz9zh02tOD9DiYRvfgUJDbT0fdAINUF 3Wz9IXlF/jAQ2eZrfLtIbSCtrmz4RUU2xvR3a5beCi2MkIWmdDyd1BujlW5mE1QXTTnBM1p0a4X K321ItWxXUGCXzTnJ+okdVJBhksAZuQHzoAFa28JuVOaDcMdZbof0oFe8MyrZ9TwI3UhEcXUsUo qFlrCVVXKmjJOnsz23kf3a/iOJ X-Received: by 2002:a17:902:e744:b0:2aa:e3d1:1438 with SMTP id d9443c01a7336-2ae2e3ecf36mr41838105ad.12.1772217091806; Fri, 27 Feb 2026 10:31:31 -0800 (PST) Received: from archlinux ([103.208.68.105]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb5dbad2sm61932485ad.34.2026.02.27.10.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Feb 2026 10:31:31 -0800 (PST) From: Adarsh Das To: clm@fb.com, dsterba@suse.com Cc: terrelln@fb.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Adarsh Das Subject: [PATCH 2/4] btrfs: clean coding style errors and warnings in compression.c Date: Sat, 28 Feb 2026 00:01:09 +0530 Message-ID: <20260227183111.9311-3-adarshdas950@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260227183111.9311-1-adarshdas950@gmail.com> References: <20260227183111.9311-1-adarshdas950@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit As the previous patch is making changes to compression.c, this patch takes the oppurtunity to fix errors and warning in compression.c Signed-off-by: Adarsh Das --- fs/btrfs/compression.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 29281aba925e..6c3be3550442 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -36,9 +36,9 @@ static struct bio_set btrfs_compressed_bioset; -static const char* const btrfs_compress_types[] = { "", "zlib", "lzo", "zstd" }; +static const char * const btrfs_compress_types[] = { "", "zlib", "lzo", "zstd" }; -const char* btrfs_compress_type2str(enum btrfs_compression_type type) +const char *btrfs_compress_type2str(enum btrfs_compression_type type) { switch (type) { case BTRFS_COMPRESS_ZLIB: @@ -478,6 +478,7 @@ static noinline int add_ra_bio_pages(struct inode *inode, if (zero_offset) { int zeros; + zeros = folio_size(folio) - zero_offset; folio_zero_range(folio, zero_offset, zeros); } @@ -780,7 +781,7 @@ struct list_head *btrfs_get_workspace(struct btrfs_fs_info *fs_info, int type, i struct workspace_manager *wsm = fs_info->compr_wsm[type]; struct list_head *workspace; int cpus = num_online_cpus(); - unsigned nofs_flag; + unsigned int nofs_flag; struct list_head *idle_ws; spinlock_t *ws_lock; atomic_t *total_ws; @@ -1163,17 +1164,17 @@ static u64 file_offset_from_bvec(const struct bio_vec *bvec) * @buf: The decompressed data buffer * @buf_len: The decompressed data length * @decompressed: Number of bytes that are already decompressed inside the - * compressed extent + * compressed extent * @cb: The compressed extent descriptor * @orig_bio: The original bio that the caller wants to read for * * An easier to understand graph is like below: * - * |<- orig_bio ->| |<- orig_bio->| - * |<------- full decompressed extent ----->| - * |<----------- @cb range ---->| - * | |<-- @buf_len -->| - * |<--- @decompressed --->| + * |<- orig_bio ->| |<- orig_bio->| + * |<------- full decompressed extent ----->| + * |<----------- @cb range ---->| + * | |<-- @buf_len -->| + * |<--- @decompressed --->| * * Note that, @cb can be a subpage of the full decompressed extent, but * @cb->start always has the same as the orig_file_offset value of the full @@ -1295,7 +1296,8 @@ static u32 shannon_entropy(struct heuristic_ws *ws) #define RADIX_BASE 4U #define COUNTERS_SIZE (1U << RADIX_BASE) -static u8 get4bits(u64 num, int shift) { +static u8 get4bits(u64 num, int shift) +{ u8 low4bits; num >>= shift; @@ -1370,7 +1372,7 @@ static void radix_sort(struct bucket_item *array, struct bucket_item *array_buf, */ memset(counters, 0, sizeof(counters)); - for (i = 0; i < num; i ++) { + for (i = 0; i < num; i++) { buf_num = array_buf[i].count; addr = get4bits(buf_num, shift); counters[addr]++; -- 2.53.0