Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp960974lqc; Fri, 8 Mar 2024 18:37:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX8wBE1U/YNQs716mfdEI2cV/7afmW/mA/CorYPTLyT4BipE8XbBiRdefF2oTEsgXIEB8cVp1hE9+juunEAefFOOIUApXP1lJDYFe1U4w== X-Google-Smtp-Source: AGHT+IGvQb1frlLb1IXoSerCbDd5/6QmmZBU/UYovANgrhiEURNdBaAOyfbto2smNWxsLxfHZ+bk X-Received: by 2002:a54:4884:0:b0:3c1:db9c:543b with SMTP id r4-20020a544884000000b003c1db9c543bmr935278oic.16.1709951860006; Fri, 08 Mar 2024 18:37:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709951859; cv=pass; d=google.com; s=arc-20160816; b=PBwd5zkGWCRTcOhEK0MTYIFXFAwXnPSf1eMdBbNOOErr45l8WGfkR/FNkJJZnN4lKh l9BaQMEEFsdpoAuMHxAVADsG9KI6RTieayJpr5RF+4Cc3sFlxFMkOh/TO4ieCqeDOwF6 fyaL0ke8ofy1ba3Y+VqVRqi6NWRVtFGEM1sgWJhJc16IuVX/JqZZ0pmmdnxAjBfDeS5Y 9mxvyeazSIPZNCEv3enU9xqAPzosCxmSYU1Z6CBnl2rprszPOrmCgvaSUOadUDO73ABO 0gX7ftqqf0EbB0ogCJT4c99+MBCeIDcM5cMKWVz1kyHvJ6HYj/eK0JSKSds8zx8yh9G0 yVNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=EPqIY44RfomfvdSfs4exdvUnb+SWr+WBXQBqExXLvyw=; fh=oJ3lSp/kR/A6KRITlKKBQnCZI9HP0KaqpT8vNJwoyxY=; b=KkgmLIB7jkMqOjRJPvUC/pISpjmwSLhKM+b/Id0VBKSJU3oy4oqzJ5VB27A0oFJHzv 7wRiYnpYckFklF88GJuQ56PZthmkcEsLJEEzSjOeiWVG51U+zZk6S9OPNhaOLyTdcmXj CYebjW3lFREsGjMmtFIB9i+01DwxRpE9Zv7dHA3WGmK53JUOkNosx6VVmUIjoSePLYPk lln51Tjc2uz9uL+/44wabD3MqATQqJ4DLhyEasUdrbXOhXQoRcYkq0fdExa7SWcgeJCk STHU73nRp2LmHlxeOyfPzse124spFdAHFNC6tW9cH59AmXwjt1QpXIvjrXHmxTlmW8IN 5+nA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gMtotnxW; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-ext4+bounces-1578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1578-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bw29-20020a056a02049d00b005d66232593dsi753302pgb.868.2024.03.08.18.37.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 18:37:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gMtotnxW; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-ext4+bounces-1578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1578-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EF65728288E for ; Sat, 9 Mar 2024 02:37:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BBC22D05C; Sat, 9 Mar 2024 02:37:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gMtotnxW" X-Original-To: linux-ext4@vger.kernel.org Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (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 BB35B2CAB; Sat, 9 Mar 2024 02:37:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709951852; cv=none; b=Tv47O/yKwiuEtyK/1n/896/sHgW6O/XxmG5gBdBAI6HkGK9D2JLKrq1v7rk5SMcD3hGgxx85Inh8GBE0slflmy7gwW3TZwcgP0djsMIfAe5Dmlf9h9K0bT97k3G71E435TVmXC5eEtq2/6enP14MwZCiwLU5V54wj63NhKdlp4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709951852; c=relaxed/simple; bh=+V5eYFbW9Pi34yqv4WG/8jsaw5ZIuEVqrbU/JjZq1UM=; h=Date:Message-Id:From:To:Cc:Subject:In-Reply-To; b=b25pb1y9hyHXwEmfLB5fI4bjdSqru8nBRPpb4dQUOHfgNoWan7xG9YunDO6TJGpqi12mKSHvzfiPHQwjeakYfG9jhs3ecCFkczh+wCE2Cx+QDYLWOIEjrYARFS/1umqmWfLjtpUPlRj1OkNcKSJz8bYBQg+7vidSXzKIJ5ihuCM= 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=gMtotnxW; arc=none smtp.client-ip=209.85.215.174 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-pg1-f174.google.com with SMTP id 41be03b00d2f7-5ca29c131ebso2334817a12.0; Fri, 08 Mar 2024 18:37:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709951850; x=1710556650; darn=vger.kernel.org; h=in-reply-to:subject:cc:to:from:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=EPqIY44RfomfvdSfs4exdvUnb+SWr+WBXQBqExXLvyw=; b=gMtotnxWP62Phz8+WkTq+HZyBKCSDqzDbgcOzZgiCl7qeew09EAJY7U5EbDrlcKq3u 3X7pRw+quiwtF5aypyrwSjBHHdXylYFBQ4sbghXc5zFpcGE8gaTkcGg4V2pfJ65o+d3G mBiGerHW7oGTxMej8FFVvyV3CJr0WnyygdJyCRIxVhFVwGUHMcp4Ww12q9AQg9CvPOiF 9uVr99IF1GXHMywp0EuX5aatSRhmSXHElkH+lUYsBQoPoVpmkotYUnMHoH5apLEU6ydE kIG1TLXCh342hP/UhlJERJlPhmXBbq1ZxvQDxnv2Z+c0J03LbE8fSepEVZi/dJ5PYWEN mPHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709951850; x=1710556650; h=in-reply-to:subject:cc:to:from:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=EPqIY44RfomfvdSfs4exdvUnb+SWr+WBXQBqExXLvyw=; b=gN9JQ1PxNZaRPlIRPnM4YYq0xoX4RW31pVR0g4AoSziXpnQsjRwRHBo2fRccmZxmLa TaMAvKexZXBmnkGJVCItc08w8R28pLqN+vE1EHhrgyF/LI+Gw1IHG8xxDF2fFfn+sbw9 apWweR9GhOHRiXfD36o4c/kUBKSfB8lg4e8yiuhVDtZ/Vr1ZGGDpCkedUUEwvcNgGuan G0KTJ2OW8paI8LpdXdYDv0kAoFfM7NFYO19M4KlGOmdiaee+j67hvIf9r84FGHKSk6au pMz93XVd9lCADnbZXPfP4vaSqmyr0KhMK5VQxm+8VHs1NDKVlLfu3AYHmsU4hIQ1hA0t LNBQ== X-Forwarded-Encrypted: i=1; AJvYcCWcO4beqqmtHubDJBWPH+kizn8BXrPXqwFeUZwy7O8TfmX9SQl5HWGAX6L7IkoPJN1BmgW7hO5dY8vq/iqlpCZYtWIJnQFtlY306jbxJQwG7sOdwExqhRA4a2VSUnpUZkb8kZAgOJmW3CfJxIHWzz7SMvVH59iJVbFZZ5QXccK2Zmld6Ax0Ktw= X-Gm-Message-State: AOJu0Yz9ejLmYYaKFPH89og/6zUDw+QEJ27pq/XIR9jb0l8Ub2HfU5Sb k8Nw3s7yTcAerXolHPUnlqQvqHaRVLiipc3PmyNqoFHd1kTqJmZ6 X-Received: by 2002:a17:902:7403:b0:1dd:e34:d820 with SMTP id g3-20020a170902740300b001dd0e34d820mr718053pll.28.1709951849852; Fri, 08 Mar 2024 18:37:29 -0800 (PST) Received: from dw-tp ([49.205.218.89]) by smtp.gmail.com with ESMTPSA id z13-20020a170903018d00b001dd7c2ea323sm142391plg.114.2024.03.08.18.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 18:37:29 -0800 (PST) Date: Sat, 09 Mar 2024 08:07:19 +0530 Message-Id: <87msr85dwg.fsf@doe.com> From: Ritesh Harjani (IBM) To: John Garry , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: Jan Kara , Theodore Ts'o , Ojaswin Mujoo , Matthew Wilcox , "Darrick J . Wong" , Luis Chamberlain , linux-kernel@vger.kernel.org, Dave Chinner Subject: Re: [RFC] ext4: Add support for ext4_map_blocks_atomic() In-Reply-To: <3a417188e5abe3048afac3d31ebbf11588b6d68d.1709927824.git.ritesh.list@gmail.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: "Ritesh Harjani (IBM)" writes: > +int ext4_map_blocks_atomic(handle_t *handle, struct inode *inode, > + struct ext4_map_blocks *map, int flags) > +{ > + unsigned int mapped_len = 0, m_len = map->m_len; > + ext4_lblk_t m_lblk = map->m_lblk; > + int ret; > + > + WARN_ON(!(flags & EXT4_GET_BLOCKS_CREATE)); > + > + do { > + ret = ext4_map_blocks(handle, inode, map, flags); > + if (ret < 0) > + return ret; > + mapped_len += map->m_len; > + map->m_lblk += map->m_len; > + map->m_len = m_len - mapped_len; > + } while (mapped_len < m_len); > + > + map->m_lblk = m_lblk; > + map->m_len = mapped_len; > + return mapped_len; ouch! 1. I need to make sure map.m_pblk is updated properly. 2. I need to make sure above call only happens with bigalloc. Sorry about that. Generally not a good idea to send something that late at night. But I guess this can be fixed easily. so hopefully the algorithm should still remain, more or less the same for ext4_map_blocks_atomic(). -ritesh