On Thu 11-04-24 10:57:25, Alistair Popple wrote:
> The page->mapping and page->index fields are normally used by the
> pagecache and rmap for looking up virtual mappings of pages. FS DAX
> implements it's own kind of page cache and rmap look ups so these
> fields are unnecessary. They are currently only used to detect
> error/warning conditions which should never occur.
> 
> A future change will change the way shared mappings are detected by
> doing normal page reference counting instead, so remove the
> unnecessary checks.
> 
> Signed-off-by: Alistair Popple <apop...@nvidia.com>
...
> -/*
> - * When it is called in dax_insert_entry(), the shared flag will indicate 
> that
> - * whether this entry is shared by multiple files.  If so, set the 
> page->mapping
> - * PAGE_MAPPING_DAX_SHARED, and use page->share as refcount.
> - */
> -static void dax_associate_entry(void *entry, struct address_space *mapping,
> -             struct vm_area_struct *vma, unsigned long address, bool shared)
> -{
> -     unsigned long size = dax_entry_size(entry), pfn, index;
> -     int i = 0;
> -
> -     if (IS_ENABLED(CONFIG_FS_DAX_LIMITED))
> -             return;
> -
> -     index = linear_page_index(vma, address & ~(size - 1));
> -     for_each_mapped_pfn(entry, pfn) {
> -             struct page *page = pfn_to_page(pfn);
> -
> -             if (shared) {
> -                     dax_page_share_get(page);
> -             } else {
> -                     WARN_ON_ONCE(page->mapping);
> -                     page->mapping = mapping;
> -                     page->index = index + i++;
> -             }
> -     }
> -}

Hum, but what about existing uses of folio->mapping and folio->index in
fs/dax.c? AFAICT this patch breaks them. What am I missing? How can this
ever work?

                                                                Honza
-- 
Jan Kara <j...@suse.com>
SUSE Labs, CR

Reply via email to