linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Improve dmesg output for swapfile+hibernation
@ 2024-05-22  7:46 Sukrit Bhatnagar
  2024-05-22  7:46 ` [PATCH 1/2] iomap: swap: print warning for unaligned swapfile Sukrit Bhatnagar
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Sukrit Bhatnagar @ 2024-05-22  7:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Christian Brauner,
	Darrick J. Wong, Andrew Morton
  Cc: linux-xfs, linux-pm, linux-fsdevel, linux-kernel, linux-mm,
	Sukrit.Bhatnagar

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-05-31 14:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-22  7:46 [PATCH 0/2] Improve dmesg output for swapfile+hibernation Sukrit Bhatnagar
2024-05-22  7:46 ` [PATCH 1/2] iomap: swap: print warning for unaligned swapfile Sukrit Bhatnagar
2024-05-22 18:02   ` Chris Li
2024-05-27 10:54     ` Sukrit.Bhatnagar
2024-05-22  7:46 ` [PATCH 2/2] mm: swap: print starting physical block offset in swapon Sukrit Bhatnagar
2024-05-22 14:56   ` Darrick J. Wong
2024-05-22 14:59     ` Christoph Hellwig
2024-05-27 11:02     ` Sukrit.Bhatnagar
2024-05-23 19:45 ` [PATCH 0/2] Improve dmesg output for swapfile+hibernation Pavel Machek
2024-05-27 11:06   ` Sukrit.Bhatnagar
2024-05-27 11:20     ` Christoph Hellwig
2024-05-27 12:51       ` Sukrit.Bhatnagar
2024-05-27 12:58         ` Christoph Hellwig
2024-05-31 14:15           ` Sukrit.Bhatnagar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).