Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1352951rdd; Wed, 10 Jan 2024 17:33:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGa1EqfbHE2qVzvU5k1TOax2yTK5F0pKG8ddEpmNEEU1fh1vj+rWW9q1NBojDV9aTPy28xb X-Received: by 2002:a05:6214:2629:b0:681:199e:a981 with SMTP id gv9-20020a056214262900b00681199ea981mr393335qvb.95.1704936805106; Wed, 10 Jan 2024 17:33:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704936805; cv=none; d=google.com; s=arc-20160816; b=r9++9klUdPL9SVqqyyfjsHT0dXf5YrzfmOCRQioZsBu0aa81OB5hFbN/hpyzDJ1R2O dl6nnGcW97F37YaImRPq0cmysFdzsXbT2RPII22xDy7CuNot+/qf9X6Kso6Oru2HNRfS kvO5qHh2ou/32ZjQehSgGEzEaN8ONMqI4807XFVDXslANJX6n/BOtJy8WiVoSQelaJnj HuDUzjx9Ir3NQqnsEQoEPmlo0ELOSaz3h8dq7018ecL6aPnjcFMgchoyx+VSIJczSdDs dgSulkpkJYQBSUeRrzTkBf9QgzrQKaInKkkhCLyytcmlPboi8xC6iMF4N20j+r7KmT5+ QyJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=KFBZnLePJgAkY6uUhTdh6q1GUW3WRiGUDJzt4U75XyY=; fh=CVABXt/2+I/w5TIrpoqOngQihKkOOcSQFZlYGDqF0qk=; b=Wj5ewxMrQQ2VDzwPBYjDnGfw5N9oN5AkC5cC4Ky0holdlT/tur0Nkgm0mUb4ugr/Pz DnykZf67rd/4t8fdBv1xgRchgTlajLP0RAXippy+MI9ZoqYPK2e4ByBJS4drvivU6wYD 7SqFm0Xv7PqVjFJ6OzrJx/W87kR/i0KLtUXhA141xVCknCYtEIT8e5TuD2kVbGCv5p+u gPM9lY14cFfdW5TBTFT8ecXjNo8FaSq97WOdPxbz8A0yJs8qd90cEefA3OUL0cR7ng+5 9GuZAYY50L+BTiFxDu4AANO4BEJ5DdU89FVDyKO5uqiaUCJWTeUlaDA/opMuApll7H2V VnUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="EHT/mtif"; spf=pass (google.com: domain of linux-kernel+bounces-22927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22927-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d26-20020a0cb2da000000b00680b1a549a6si5531078qvf.380.2024.01.10.17.33.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 17:33:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="EHT/mtif"; spf=pass (google.com: domain of linux-kernel+bounces-22927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22927-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D889B1C22ECB for ; Thu, 11 Jan 2024 01:33:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36FC0809; Thu, 11 Jan 2024 01:33:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EHT/mtif" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54A1C7E4 for ; Thu, 11 Jan 2024 01:33:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 103DBC433C7; Thu, 11 Jan 2024 01:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704936796; bh=s0lQMwjpjbzCiToFVB40JTvmIeU+wECrc+VCMfehSW4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=EHT/mtifffgH7aCZm8gtAW5stnregXiHGg+IzlQwEolwUaqyyShCE1k6xcQQtJZVy y9F+HqZv65UrXIe/GFDeMYzo0TcNoU25Hz9kDm4XkKP2Z/Grb+NS8JlnrdlRLz/Pwd 2bXCLUXIf6ch2GafcdGmsDqSTK7tCZ7ShF0xHF2pxR9IDqxW2ov8eFfD/8dUsgUH7x LJEoUzZLPlaokeGAuf22h2ixrBclEoCjVHxWHcg6V0uMsCVEugTtlkS0EwlYp5AKQq U4uaTyNCW+t4gFNKS3Qqv8y4J4nitZbTw74kId6mvlEOzlWH6zRywWyVsql1LryFmO UUdwJa9FL5rUw== Message-ID: Date: Thu, 11 Jan 2024 09:33:21 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [f2fs-dev] [PATCH v3 3/6] f2fs: compress: fix to check unreleased compressed cluster Content-Language: en-US To: Daeho Jeong Cc: jaegeuk@kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <20231228143152.1543509-1-chao@kernel.org> <20231228143152.1543509-3-chao@kernel.org> From: Chao Yu Autocrypt: addr=chao@kernel.org; keydata= xsFNBFYs6bUBEADJuxYGZRMvAEySns+DKVtVQRKDYcHlmj+s9is35mtlhrLyjm35FWJY099R 6DL9bp8tAzLJOMBn9RuTsu7hbRDErCCTiyXWAsFsPkpt5jgTOy90OQVyTon1i/fDz4sgGOrL 1tUfcx4m5i5EICpdSuXm0dLsC5lFB2KffLNw/ZfRuS+nNlzUm9lomLXxOgAsOpuEVps7RdYy UEC81IYCAnweojFbbK8U6u4Xuu5DNlFqRFe/MBkpOwz4Nb+caCx4GICBjybG1qLl2vcGFNkh eV2i8XEdUS8CJP2rnp0D8DM0+Js+QmAi/kNHP8jzr7CdG5tje1WIVGH6ec8g8oo7kIuFFadO kwy6FSG1kRzkt4Ui2d0z3MF5SYgA1EWQfSqhCPzrTl4rJuZ72ZVirVxQi49Ei2BI+PQhraJ+ pVXd8SnIKpn8L2A/kFMCklYUaLT8kl6Bm+HhKP9xYMtDhgZatqOiyVV6HFewfb58HyUjxpza 1C35+tplQ9klsejuJA4Fw9y4lhdiFk8y2MppskaqKg950oHiqbJcDMEOfdo3NY6/tXHFaeN1 etzLc1N3Y0pG8qS/mehcIXa3Qs2fcurIuLBa+mFiFWrdfgUkvicSYqOimsrE/Ezw9hYhAHq4 KoW4LQoKyLbrdOBJFW0bn5FWBI4Jir1kIFHNgg3POH8EZZDWbQARAQABzRlDaGFvIFl1IDxj aGFvQGtlcm5lbC5vcmc+wsF3BBMBCgAhBQJWLOm1AhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4B AheAAAoJEKTPgB1/p52Gm2MP/0zawCU6QN7TZuJ8R1yfdhYr0cholc8ZuPoGim69udQ3otet wkTNARnpuK5FG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Js6rAb 0NpGhy3XKY7HOSNIeHvIbDHTUZrewD2A6ARw1VYg1vhJbqUE4qKoUL1wLmxHrk+zHUEyLHUq aDpDMZArdNKpT6Nh9ySUFzlWkHUsj7uUNxU3A6GTum2aU3Gh0CD1p8+FYlG1dGhO5boTIUsR 6ho73ZNk1bwUj/wOcqWu+ZdnQa3zbfvMI9o/kFlOu8iTGlD8sNjJK+Y/fPK3znFqoqqKmSFZ aiRALjAZH6ufspvYAJEJE9eZSX7Rtdyt30MMHQARAQABwsFfBBgBCgAJBQJWLOm1AhsMAAoJ EKTPgB1/p52GPpoP/2LOn/5KSkGHGmdjzRoQHBTdm2YV1YwgADg52/mU68Wo6viStZqcVEnX 3ALsWeETod3qeBCJ/TR2C6hnsqsALkXMFFJTX8aRi/E4WgBqNvNgAkWGsg5XKB3JUoJmQLqe CGVCT1OSQA/gTEfB8tTZAGFwlw1D3W988CiGnnRb2EEqU4pEuBoQir0sixJzFWybf0jjEi7P pODxw/NCyIf9GNRNYByUTVKnC7C51a3b1gNs10aTUmRfQuu+iM5yST5qMp4ls/yYl5ybr7N1 zSq9iuL13I35csBOn13U5NE67zEb/pCFspZ6ByU4zxChSOTdIJSm4/DEKlqQZhh3FnVHh2Ld eG/Wbc1KVLZYX1NNbXTz7gBlVYe8aGpPNffsEsfNCGsFDGth0tC32zLT+5/r43awmxSJfx2P 5aGkpdszvvyZ4hvcDfZ7U5CBItP/tWXYV0DDl8rCFmhZZw570vlx8AnTiC1v1FzrNfvtuxm3 92Qh98hAj3cMFKtEVbLKJvrc2AO+mQlS7zl1qWblEhpZnXi05S1AoT0gDW2lwe54VfT3ySon 8Klpbp5W4eEoY21tLwuNzgUMxmycfM4GaJWNCncKuMT4qGVQO9SPFs0vgUrdBUC5Pn5ZJ46X mZA0DUz0S8BJtYGI0DUC/jAKhIgy1vAx39y7sAshwu2VILa71tXJ In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/1/11 9:18, Daeho Jeong wrote: > On Thu, Dec 28, 2023 at 6:33 AM Chao Yu wrote: >> >> From: Sheng Yong >> >> Compressed cluster may not be released due to we can fail in >> release_compress_blocks(), fix to handle reserved compressed >> cluster correctly in reserve_compress_blocks(). >> >> Fixes: 4c8ff7095bef ("f2fs: support data compression") >> Signed-off-by: Sheng Yong >> Signed-off-by: Chao Yu >> --- >> fs/f2fs/file.c | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >> index 026d05a7edd8..782ae3be48f6 100644 >> --- a/fs/f2fs/file.c >> +++ b/fs/f2fs/file.c >> @@ -3624,6 +3624,15 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count) >> goto next; >> } >> >> + /* >> + * compressed cluster was not released due to >> + * it fails in release_compress_blocks(). >> + */ >> + if (blkaddr == NEW_ADDR) { >> + compr_blocks++; >> + continue; >> + } >> + >> if (__is_valid_data_blkaddr(blkaddr)) { >> compr_blocks++; >> continue; > > How about merging two conditions like "blkaddr == NEW_ADDR || > __is_valid_data_blkaddr(blkaddr)"? Oh, sure. > >> @@ -3633,6 +3642,9 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count) >> } >> >> reserved = cluster_size - compr_blocks; >> + if (!reserved) >> + goto next; >> + > > How can the reserved variable be zero? I guess it can happen if a cluster was not released during release_compress_blocks(), then all blocks in the cluster should has been reserved, so, in this round of reserving, it needs to skip reserve blocks, right? Thanks, > >> ret = inc_valid_block_count(sbi, dn->inode, &reserved); >> if (ret) >> return ret; >> -- >> 2.40.1 >> >> >> >> _______________________________________________ >> Linux-f2fs-devel mailing list >> Linux-f2fs-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel