Skip to content

Commit 39f985c

Browse files
Matthew Wilcox (Oracle)dhowells
authored andcommitted
fs/cachefiles: Remove wait_bit_key layout dependency
Cachefiles was relying on wait_page_key and wait_bit_key being the same layout, which is fragile. Now that wait_page_key is exposed in the pagemap.h header, we can remove that fragility A comment on the need to maintain structure layout equivalence was added by Linus[1] and that is no longer applicable. Fixes: 6290602 ("mm: add PageWaiters indicating tasks are waiting for a page bit") Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: kafs-testing@auristor.com cc: linux-cachefs@redhat.com cc: linux-mm@kvack.org Link: https://lore.kernel.org/r/20210320054104.1300774-2-willy@infradead.org/ Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3510ca20ece0150af6b10c77a74ff1b5c198e3e2 [1]
1 parent 0d02ec6 commit 39f985c

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

fs/cachefiles/rdwr.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,16 @@ static int cachefiles_read_waiter(wait_queue_entry_t *wait, unsigned mode,
2424
container_of(wait, struct cachefiles_one_read, monitor);
2525
struct cachefiles_object *object;
2626
struct fscache_retrieval *op = monitor->op;
27-
struct wait_bit_key *key = _key;
27+
struct wait_page_key *key = _key;
2828
struct page *page = wait->private;
2929

3030
ASSERT(key);
3131

3232
_enter("{%lu},%u,%d,{%p,%u}",
3333
monitor->netfs_page->index, mode, sync,
34-
key->flags, key->bit_nr);
34+
key->page, key->bit_nr);
3535

36-
if (key->flags != &page->flags ||
37-
key->bit_nr != PG_locked)
36+
if (key->page != page || key->bit_nr != PG_locked)
3837
return 0;
3938

4039
_debug("--- monitor %p %lx ---", page, page->flags);

include/linux/pagemap.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,6 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
559559
return pgoff;
560560
}
561561

562-
/* This has the same layout as wait_bit_key - see fs/cachefiles/rdwr.c */
563562
struct wait_page_key {
564563
struct page *page;
565564
int bit_nr;

0 commit comments

Comments
 (0)