Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp182723lqp; Wed, 22 May 2024 00:53:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU3J+3jsPVjueSU1W+CyU2PdNM7smF9K8KrmtsZkkXeC/rdAsQzFyFD+eTS077cCKDYuhrc+TxPHWqnn26gD/Cvsj2oPDrBIehLLtjoPQ== X-Google-Smtp-Source: AGHT+IGbRdDHVW9TzAR6TPB99xSMRyBUViDGn80zASopYHEEl+kyBDETUdTLm8SvR2sly8SpWlYJ X-Received: by 2002:a17:902:c408:b0:1f3:494:2090 with SMTP id d9443c01a7336-1f31c9e6e34mr12745265ad.55.1716364437722; Wed, 22 May 2024 00:53:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716364437; cv=pass; d=google.com; s=arc-20160816; b=RPjp3Jjf1u2XNnWnKDDMEOZObTAohMH6KW+AiPXkDYxUjdaMHxaExht3NKZF2HXXyi aIVqx1OCwdB0R+5ila9bQcu2V/1K+Vo1GPSAw0pY4iO3yE1DjI6HxJeYFxv3PcWYOiiB oIOH0uFHhitjwwJ7UzlYD65xWk8epplBHYXTenmi9+PIi1vii4WXxCpzGkM7gV3A29s2 iCoR3g6RJ+f5G/WvAoEtIN2gI0Df5MklPNy59nphdVVBTrxIT4V0nqk/sS4RIP4hUPoS bYtGDvQyxvY5jEVoAnFKSiJ0S0yshM6CYuDW59Fl5sFpLN8O+/xtJE856WLW/iOR5KhU O4oQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=AIWEN8D6NjuFU1bmJszkWUHQ/Up5x+riI0D821zKlIY=; fh=5/CQjkakIdBXPSjYMrkL5A/mlBcJavF7822SPyatFxE=; b=pW1k1LR6xNcjZNFvzJ8MIxJ9JPdHpJ0HA8252nUmVBA5YAS+1l12NB+EtJ1BPDyAwp kXVvV62APw3iiBNO89MqWN+WrwB7zWQe42i+4jg6KlgMtbn6erpX/k/NgX7Q3+BKI3N5 VLEGSWFrlaIKzjfVYoW8yHe+D6wSdhUH80FLzi717htzzO8jBePUZ8QYpu4q1Ttu4b29 VVC/Yl7gZw2JWRD76/qFbCKYUB1dzX/hrjLz6UZgmCDsBh7dsCWD6/lmDqi6A/gepkFx afxxUl1CWZbDxpkqqupxRYuFO4lEieTPPQTTrmOi04o286HZHt4B1bmEgSRA4KvjdC+Z 2xEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sony.com header.s=s1jp header.b="WwyV/xR4"; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.com); spf=pass (google.com: domain of linux-kernel+bounces-185883-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185883-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sony.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0bad6198si243705305ad.164.2024.05.22.00.53.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 00:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185883-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@sony.com header.s=s1jp header.b="WwyV/xR4"; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.com); spf=pass (google.com: domain of linux-kernel+bounces-185883-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185883-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sony.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 36F8B282566 for ; Wed, 22 May 2024 07:53:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C8A480032; Wed, 22 May 2024 07:53:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="WwyV/xR4" Received: from jpms-ob02.noc.sony.co.jp (jpms-ob02.noc.sony.co.jp [211.125.140.165]) (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 72D467FBA3; Wed, 22 May 2024 07:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.125.140.165 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716364382; cv=none; b=FLK2EZrTwA89kOXuFfZg7M7l7QFzFIW7hdPqn9c3fM3LUnAZ7ZKx4CKcA/4o9UKQJiS+S5nMDo/vsYhZ+b6LFQn2CR/WAgKZnrRXhSr/8tgJf2tCdk+tVgjVjwvIyru7AxubJVdk1sHaqQxWsp/Yni9TYAfk4VEizvMZHB+W3wg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716364382; c=relaxed/simple; bh=7hh+JKNoOSYUXcr16/GBfPDuDDEZW0YlbjXrngNmoH4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=OohshTE6jkkqis6Nm2c8DU4JiXo0xpDGwT+XUQxkEPbrWH/ZlcirOS0b8FziU9sFCPwP/Mxm5s0/GAHrlh5dN+EYyg6oHABRKdNuI4VnWff/EAADHyupnExxMCVuH9d7Oal5M/eWaAm6+19EuI0wifAi/xjxDNcvT56lQ9EXWkE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com; spf=pass smtp.mailfrom=sony.com; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b=WwyV/xR4; arc=none smtp.client-ip=211.125.140.165 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sony.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; s=s1jp; t=1716364381; x=1747900381; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=AIWEN8D6NjuFU1bmJszkWUHQ/Up5x+riI0D821zKlIY=; b=WwyV/xR4c75UOFx+GWT2T38o/ljVHJ5fchnxWh+NHsZDuOQ5zOExLujA RW09m+6KapekXKJ6Rz+EOM2AWvh5/D+fP7CVA2oMNYzZT3ZZjT0wA0xtm CkKFjcJV0FZsONrNgDtDUpOc1asPwPDlnboa/r3eiDKsWanQLOiF1qM1R 33pYdwL1solHzWvy29DC3h5k5MkkoZMymGx4dTSFV2JSUUnRvedj2DszP zTZmgiIHMLgSvblXz93m43zmnh8+hePJtAqJkfJrcMW1YKXFbA/hEz4IR Ncs0sx/YsTaw/tqjGRYUuOAxid96sn57poiq0hSIfWqzQnv2x9yjzEdBG A==; Received: from unknown (HELO jpmta-ob1.noc.sony.co.jp) ([IPv6:2001:cf8:0:6e7::6]) by jpms-ob02.noc.sony.co.jp with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2024 16:42:51 +0900 X-IronPort-AV: E=Sophos;i="6.08,179,1712588400"; d="scan'208";a="415026695" Received: from unknown (HELO OptiPlex-7080..) ([IPv6:2001:cf8:1:5f1:0:dddd:6fe5:f4d0]) by jpmta-ob1.noc.sony.co.jp with ESMTP; 22 May 2024 16:42:51 +0900 From: Sukrit Bhatnagar To: "Rafael J. Wysocki" , Pavel Machek , Christian Brauner , "Darrick J. Wong" , Andrew Morton Cc: linux-xfs@vger.kernel.org, linux-pm@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sukrit.Bhatnagar@sony.com Subject: [PATCH 0/2] Improve dmesg output for swapfile+hibernation Date: Wed, 22 May 2024 16:46:56 +0900 Message-Id: <20240522074658.2420468-1-Sukrit.Bhatnagar@sony.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit While trying to use a swapfile for hibernation, I noticed that the suspend process was failing when it tried to search for the swap to use for snapshot. I had created the swapfile on ext4 and got the starting physical block offset using the filefrag command. Upon looking at the swap activation code, I realized that the iomap part is doing some rounding up for the physical offset of the swapfile. Then I checked the block size of the filesystem, which was actually set to 1KB by default in my environment. (This was in buildroot, using the genimage utility to create the VM disk partitions, filesystems etc.) The block offset is rounded-up and stored in the swap extents metadata by iomap code, but as the exact value is lost for 1KB-block filesystem, hibernate cannot read back the swap header after it finishes writing data pages to swap. Note that this is not a bug in my understanding. Both swapfile and hibernate subsystems have the correct handling of this edge case, individually. Another observation was that we need to rely on external commands, such as filefrag for getting the swapfile offset value. This value can be conveniently printed in dmesg output when doing swapon. Sukrit Bhatnagar (2): iomap: swap: print warning for unaligned swapfile mm: swap: print starting physical block offset in swapon fs/iomap/swapfile.c | 10 ++++++++++ mm/swapfile.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) -- 2.34.1