On Thu, Feb 06, 2020 at 08:17:20AM +0000, Johannes Thumshirn wrote:
> >> + super = kmap(page);
> >> if (btrfs_super_bytenr(super) != bytenr ||
> >> btrfs_super_magic(super) != BTRFS_MAGIC) {
> >> - brelse(bh);
> >> + kunmap(page);
> >> + put_page(page);
> >> return -EINVAL;
> >> }
> >> + kunmap(page);
> >
> > Also last time I wondered why we can't leave the page mapped for the
> > caller and also return the virtual address? That would keep the
> > callers a little cleaner. Note that you don't need to pass the
> > struct page in that case as the unmap helper can use kmap_to_page (and
> > I think a helper would be really nice for the unmap and put anyway).
> >
>
> There's btrfs_release_disk_super() but David didn't like the use of it
> in v2 of this series. But when using a 'struct btrfs_disk_super' instead
> of a 'struct page' I think he could be ok.
Also I just noticed don't even need the kmap/kunmap at all given that the
block device mapping is never in highmem.