Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1346932rdd; Wed, 10 Jan 2024 17:18:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKVR/onYgZg40lmzwm9dv4BvjhUD8WhefaVGSkxuGXQHY5kachkRksgrfSvVs79Uff/RiZ X-Received: by 2002:a05:6e02:1c49:b0:360:e6b:bc65 with SMTP id d9-20020a056e021c4900b003600e6bbc65mr585458ilg.55.1704935906652; Wed, 10 Jan 2024 17:18:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704935906; cv=none; d=google.com; s=arc-20160816; b=cBbovx3gRYNJkMN1RhQuDEUplSgqUZH9CFAP5fqGSdBw8mJscl8kEulqb22Xfqrp1n kWBz4BI9bZwXx3awqPljOilqnn7MZ7ahWPgvN0kAX4bZF6If5hyI/QevwH+X8uUDtNBI 2fq+9Teaub5pMsQNiwIzNZSMm2vHQtwwJ2ezPmS+qk/EI4hoI/Fu09iIkEPoTKd6JnQ1 6IGWlB99lMIhNBmiYEo03KmOd0Qey2bnIC2GxhhHZ4UKUuFmdLE7UVIl0vVCsbuJ7qWV 6AIlEUPlpgE/GCnE904GIpAoX0VgR3flHFB8/Q9rkiZaM3O70pZ/D9PnuhtwR8DG3iu0 VLWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=pHtMusYzsiQkjwSqtRZvJBvHhlKunDRXowWcJK81xTQ=; fh=HSbZBoqfPPu29USLL22LZlK5/916a1HOg8gfajXborE=; b=0Wt/lPY8fIlcefxrKpWwDGYgPiWHTFO98qUvaOOG6mrLnQD9NNZcWuWo7TM6tJygpr MWdZjlN84PxCL5OlF66h7Nz5WmnEmu8G/BJv6q65sb1MHRS1Sh4Tt6ApaE2/9AhpAV+z bdPmK16GkgWVXM49lYeAmkhNj4bLhmrm70XvXOkoaXmfW5ROGZQgsoP0QHDMZcHj1LS9 VCuIOuDfzwCuxJnmjtCraDovHPw6jJCf72eiNSdrIecGX7Zy9wbypA2qCJjtFqQIAMb7 Qsvq4YBUM3wq2JlQfIQbU0ipMKeOlMzC+99f6hdxC/pIhOcG3Y07hzCYii0m+DmVtbvz k4Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XO4Aqbrd; spf=pass (google.com: domain of linux-kernel+bounces-22921-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22921-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y63-20020a636442000000b005cd79ebed84si4669312pgb.341.2024.01.10.17.18.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 17:18:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22921-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XO4Aqbrd; spf=pass (google.com: domain of linux-kernel+bounces-22921-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22921-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 376AFB26AEB for ; Thu, 11 Jan 2024 01:18:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42D39EC9; Thu, 11 Jan 2024 01:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XO4Aqbrd" Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (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 15BF5EA3 for ; Thu, 11 Jan 2024 01:18:12 +0000 (UTC) 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 Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-598a32d05ffso460963eaf.1 for ; Wed, 10 Jan 2024 17:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704935892; x=1705540692; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pHtMusYzsiQkjwSqtRZvJBvHhlKunDRXowWcJK81xTQ=; b=XO4AqbrdJYVUV0hTb7FimrImSxweBpfIz4E2NqC8QwTa/p8CrsTRcra20nTSEevUDp c3mSqZG28OhD8DG9+gvaianwDarfrTmx92T/1CqA87vdfbldN+iT9qM3RENSHHXhHX5U d7QbZKA3ZI39JVmygWhq50OWIZLce+v8hQ73mbcP74j/QMKdCH01opbDUSPPOJZOJSQP 0xNoLPQQzsm55Xqj3gqcwX+IEIBnj+egYhEst9FEQSaj6jgkJaykvDNO0jeKyCXB8E7H 5w4YGU/eCPxYMqDOpCLgVKAbcdnzkjCH0i337rhg+ZuytbHrauxj6JSiT3zEnifisuQd QT8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704935892; x=1705540692; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pHtMusYzsiQkjwSqtRZvJBvHhlKunDRXowWcJK81xTQ=; b=u34yUZ07N2ZKcQJli7AyWxITbfTPNLEuJoAYsY5QkAEUlX/vhqCTO/oWdQbG7uuTE/ JUv59rqsXH2T2+46Qip09rjZDdrkhEnBr9dl3MdXtbQUYky9OYPxJT7pNeoXTexgvNw/ g51w/jnwG4wX2tSyKI7Pi8C2mPrNCYzju32UMfEf9bIEXJvqRBfGwxK/j26NOJewO9Lk CsGnhZqsVktlmbVST7f4hOo65FBKHv8uH4WMPDpqqgQ5B72UAiiCWNcS995jvK9L6Mqn TiZLrBvUhGPMsX0duk/Mu8xCl1uLzSuF0DjvKQWaH3ZSHYkaTVZEff45Ie6r4xdOFouO +c6Q== X-Gm-Message-State: AOJu0YwaJN8UfpBkq0B38aJdbseeLgbEamOiAz3DAqpT50+yXPsNZ7DF WjQLaeP4nrE5jmaf/GooHB6EGkKM1DS8Uso/nmQiQnDApWtsrnJS X-Received: by 2002:a05:6808:448c:b0:3bd:4264:32aa with SMTP id eq12-20020a056808448c00b003bd426432aamr558283oib.96.1704935892069; Wed, 10 Jan 2024 17:18:12 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231228143152.1543509-1-chao@kernel.org> <20231228143152.1543509-3-chao@kernel.org> In-Reply-To: <20231228143152.1543509-3-chao@kernel.org> From: Daeho Jeong Date: Wed, 10 Jan 2024 17:18:01 -0800 Message-ID: Subject: Re: [f2fs-dev] [PATCH v3 3/6] f2fs: compress: fix to check unreleased compressed cluster To: Chao Yu Cc: jaegeuk@kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 28, 2023 at 6:33=E2=80=AFAM 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 =3D=3D NEW_ADDR) { > + compr_blocks++; > + continue; > + } > + > if (__is_valid_data_blkaddr(blkaddr)) { > compr_blocks++; > continue; How about merging two conditions like "blkaddr =3D=3D NEW_ADDR || __is_valid_data_blkaddr(blkaddr)"? > @@ -3633,6 +3642,9 @@ static int reserve_compress_blocks(struct dnode_of_= data *dn, pgoff_t count) > } > > reserved =3D cluster_size - compr_blocks; > + if (!reserved) > + goto next; > + How can the reserved variable be zero? > ret =3D 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