From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc251.phx1.oracleemaildelivery.com (aib29ajc251.phx1.oracleemaildelivery.com [192.29.103.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A90A8C6FD1B for ; Mon, 6 Mar 2023 13:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=cWE0LMY4fRW5vGvFHYpFied/caKKihnwc5cRTMcuv5M=; b=rWN+NpB+q7XwwdUkEu3MmAEryKfTj5k/Qvw6DhngEA0Zqj5ogRrOL/UtvI2nMVn2FqIvgwAKAHoA 4Vd+/+0rvgxnCsyN+HnWG34fG8ioV+/RfEcpGmDJT/mospKFEHWityg6VaRGq909phGDwTXMqhYv kMG5Wqd1Zee8EqTAqdnDyLTi13oQBKZ/Hd7RYRHiLbRRvkPTsZ/pDL7NSZLWSjf1pokCicoah8EW gN21Ydv/+40jXqD4MyDi/KZir9fZCXgFz/osJDcOQ4hqRyDl/7AmH5yNt3yFnSpAOY7U/GOdriT2 r6WmEGAtkGvPKBvHRn9yx1UI+vsJVGFNEXhvNA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=cWE0LMY4fRW5vGvFHYpFied/caKKihnwc5cRTMcuv5M=; b=nk8umzWptA/qOKFMD/d4qSR3Kky0/dmvrTdnYwJBK5z2KP4ABausiEFXE/ljVWaXCFQ3eqb+WzJV S/TCKLkAQTaIcZ5x9BJu92yaDkNxQPw8BGVII3cdnRt7SU/hR6w05JfL7ZVbOQzE1Tgdm1hN1dN4 Q/6v66nnvgw7NwJkr3Bj5cLnZ/YKWumlfVrqeSGHq5muqxp2ldQiQDyPa9czztWV4tk/Jmmi+Juk ty5u8hlUQHJhBeje10jvm1sSHGjvnUAf/gcFWGDtwzyS0121hxf43iCFUk536Wkdm1O/S3WWBWIu 6ipN71QCEAjKYnV45UMlj/10nqP5PcNeVh0Org== Received: by omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20230214 64bit (built Feb 14 2023)) with ESMTPS id <0RR300HKIQC6VF10@omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Mar 2023 13:48:06 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678110475; bh=0kprs/8xFEDaT3SMj4VbikZDm7XFilV4gu1TLiCUCBA=; h=Subject:To:Cc:From:Date:From; b=mJzxMVzt+s7ceM+KUz8TIlrJ2L3ehUIsNQS9od6ynQVe4w4Ytgs6WQg5/xzJy57Jl jabfUqCYIRTak/EBkf2ydl70TtSiE1QEUxYseZr9WOLvKmEJvEduWS0s7pGBYa06vn Est6kaAYrT4EHXyHu1ObIFgm11UT83Sh0fOzAs5s= To: akpm@linux-foundation.org, gechangwei@live.cn, ghe@suse.com, gregkh@linuxfoundation.org, heming.zhao@suse.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, junxiao.bi@oracle.com, mark@fasheh.com, ocfs2-devel@oss.oracle.com, piaojun@huawei.com Date: Mon, 06 Mar 2023 14:44:21 +0100 Message-id: <1678110261239252@kroah.com> MIME-version: 1.0 X-Source-IP: 139.178.84.217 X-Proofpoint-Virus-Version: vendor=nai engine=6500 definitions=10641 signatures=596816 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 adultscore=0 impostorscore=0 priorityscore=178 mlxlogscore=999 malwarescore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 clxscore=114 suspectscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303060122 Cc: stable-commits@vger.kernel.org Subject: [Ocfs2-devel] Patch "ocfs2: fix non-auto defrag path not working issue" has been added to the 5.4-stable tree X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: gregkh--- via Ocfs2-devel Reply-to: gregkh@linuxfoundation.org Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-stable: commit X-Patchwork-Hint: ignore X-ServerName: dfw.source.kernel.org X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:72.55.140.81 ip4:52.25.139.140 ip4:139.178.84.217 ip6:2604:1380:4641:c500::1 ip4:145.40.68.75 ip6:2604:1380:4601:e00::1 ip4:145.40.73.55 ip6:2604:1380:40e1:4800::1 include:_spf.google.com include:amazonses.com include:_spf.salesforce.com -all X-Spam: Clean X-Proofpoint-GUID: 1rW--mi70lF-b9eSULkes02gkczpNXbC X-Proofpoint-ORIG-GUID: 1rW--mi70lF-b9eSULkes02gkczpNXbC Reporting-Meta: AAFV4aTZ3tKV7dtu3nA+fP20r5xJF35lz0e34r1d0LoyZ2+e8aRvDvqgxgjVu/WU CGntoqIJsIupjjGe0MT6WJMMV+6v6SH+9CxuZ/PWFHj+q69alopKK/pg6M6laRNM W0+0FSgrZOfsrhCcTcEr3GvVsmBHYlNeagmxhTPOkHaGF1UeKjtJ3NZiVXo4uJ7X RrKLKHG5y7XizGsPUdTAx2yIw6bN6T3ApWpngmCRmSDr5Vkj3Ndo/iCscX0Nstzs teICAUnPtDRbeV/vFbuBMoyRy7Y8Nd3H90l0YOCXjHwmZleYYZg6ebenNMeMiwyB 2cs9RtQ+JqUGGh9YrL9zJBzBCRhfm5PMsr3QL12Ptzp7+pmpKDxQWyTaEdXW5LFx 1gr006uQEsLUYzL7O9eQo3KPwgZDSf/UpnLXTu5Cg/TxYjiO2l/UuWb2mfAyV1WJ LN/DiMVuUJWp3/0U0L5NkiNfaBD+ntDjRpEH0YVvw3KSUjEBksGBHbpHeabtExGf pD3lYtqn0wr8DYFFTxLdK8sPNvAJfwDJP7c1OpMew0c3 This is a note to let you know that I've just added the patch titled ocfs2: fix non-auto defrag path not working issue to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ocfs2-fix-non-auto-defrag-path-not-working-issue.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From 236b9254f8d1edc273ad88b420aa85fbd84f492d Mon Sep 17 00:00:00 2001 From: Heming Zhao via Ocfs2-devel Date: Mon, 20 Feb 2023 13:05:26 +0800 Subject: ocfs2: fix non-auto defrag path not working issue From: Heming Zhao via Ocfs2-devel commit 236b9254f8d1edc273ad88b420aa85fbd84f492d upstream. This fixes three issues on move extents ioctl without auto defrag: a) In ocfs2_find_victim_alloc_group(), we have to convert bits to block first in case of global bitmap. b) In ocfs2_probe_alloc_group(), when finding enough bits in block group bitmap, we have to back off move_len to start pos as well, otherwise it may corrupt filesystem. c) In ocfs2_ioctl_move_extents(), set me_threshold both for non-auto and auto defrag paths. Otherwise it will set move_max_hop to 0 and finally cause unexpectedly ENOSPC error. Currently there are no tools triggering the above issues since defragfs.ocfs2 enables auto defrag by default. Tested with manually changing defragfs.ocfs2 to run non auto defrag path. Link: https://lkml.kernel.org/r/20230220050526.22020-1-heming.zhao@suse.com Signed-off-by: Heming Zhao Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Gang He Cc: Jun Piao Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/ocfs2/move_extents.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c @@ -436,7 +436,7 @@ static int ocfs2_find_victim_alloc_group bg = (struct ocfs2_group_desc *)gd_bh->b_data; if (vict_blkno < (le64_to_cpu(bg->bg_blkno) + - le16_to_cpu(bg->bg_bits))) { + (le16_to_cpu(bg->bg_bits) << bits_per_unit))) { *ret_bh = gd_bh; *vict_bit = (vict_blkno - blkno) >> @@ -551,6 +551,7 @@ static void ocfs2_probe_alloc_group(stru last_free_bits++; if (last_free_bits == move_len) { + i -= move_len; *goal_bit = i; *phys_cpos = base_cpos + i; break; @@ -1022,18 +1023,19 @@ int ocfs2_ioctl_move_extents(struct file context->range = ⦥ + /* + * ok, the default theshold for the defragmentation + * is 1M, since our maximum clustersize was 1M also. + * any thought? + */ + if (!range.me_threshold) + range.me_threshold = 1024 * 1024; + + if (range.me_threshold > i_size_read(inode)) + range.me_threshold = i_size_read(inode); + if (range.me_flags & OCFS2_MOVE_EXT_FL_AUTO_DEFRAG) { context->auto_defrag = 1; - /* - * ok, the default theshold for the defragmentation - * is 1M, since our maximum clustersize was 1M also. - * any thought? - */ - if (!range.me_threshold) - range.me_threshold = 1024 * 1024; - - if (range.me_threshold > i_size_read(inode)) - range.me_threshold = i_size_read(inode); if (range.me_flags & OCFS2_MOVE_EXT_FL_PART_DEFRAG) context->partial = 1; Patches currently in stable-queue which might be from ocfs2-devel@oss.oracle.com are queue-5.4/ocfs2-fix-non-auto-defrag-path-not-working-issue.patch queue-5.4/ocfs2-fix-defrag-path-triggering-jbd2-assert.patch _______________________________________________ Ocfs2-devel mailing list Ocfs2-devel@oss.oracle.com https://oss.oracle.com/mailman/listinfo/ocfs2-devel