migration/multifd: Rewrite multifd_queue_page()
commitf88f86c4ee3fe673b34873e27af2de0a16fe01fd
authorPeter Xu <peterx@redhat.com>
Fri, 2 Feb 2024 10:28:52 +0000 (2 18:28 +0800)
committerPeter Xu <peterx@redhat.com>
Mon, 5 Feb 2024 06:42:10 +0000 (5 14:42 +0800)
tree0263f733f10b4263f29cf84ba288e46cc0a7fcd5
parent3b40964a863d69121733c8b9794a02347ed0000b
migration/multifd: Rewrite multifd_queue_page()

The current multifd_queue_page() is not easy to read and follow.  It is not
good with a few reasons:

  - No helper at all to show what exactly does a condition mean; in short,
  readability is low.

  - Rely on pages->ramblock being cleared to detect an empty queue.  It's
  slightly an overload of the ramblock pointer, per Fabiano [1], which I
  also agree.

  - Contains a self recursion, even if not necessary..

Rewrite this function.  We add some comments to make it even clearer on
what it does.

[1] https://lore.kernel.org/r/87wmrpjzew.fsf@suse.de

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20240202102857.110210-19-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
migration/multifd.c