On Sat, Jul 06, 2024 at 10:10:21AM +0200, Christoph Hellwig wrote: > Also this means we know the loop doesn't do anything if mark_dirty is > false, which is another trivial check that can move into > bio_release_pages. As this optimization already applies as-is I'll > send a prep patch for it. > > so that we can avoid the npages calculation for the !BIO_PAGE_PINNED > case. Morover having the BIO_PAGE_PINNED knowledge there means we > can skip the entire loop for !BIO_PAGE_PINNED && Braino - we're obviously already skipping it for all !BIO_PAGE_PINNED case. So discard most of this except for that fact that we should skip the wrapper doing the extra BIO_PAGE_PINNED checks.