Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3427179pxf; Mon, 29 Mar 2021 01:47:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi3NbNOXnT4LO8oFY7sjge6kqVc8U2SuqtRqqX8sSFaW/L7JlOKjyFqICNmtKTu/ReBzSz X-Received: by 2002:aa7:c9c8:: with SMTP id i8mr26994604edt.193.1617007642584; Mon, 29 Mar 2021 01:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617007642; cv=none; d=google.com; s=arc-20160816; b=CLRRxD2kOKZJ/c5v2DshYXy4vYOAvhpBOTwY008mFQYmlbyqOnE8MPSsvk4+VAmCyp qZcwb657Y/0ArD9UlH1UGollRPRUPgufzDwBrC46X6XroqhNwXvN7QcSzbbdQNNILH3r dOIm/NOGCKYxi44SijRHA0g1cQ3BOFz0SzfIDewPBHB5T5iN86aWXml3kntQossWFpGs gVVz3ITeyjxT477t8uwhBLrTnWdUOgVo8wKYm7P1JFc3JMmFy3yfH1VeTQQQUeK55/YH TySZBVJJ3sMWTZF93e7+wK5JZYVlL2oua1HwRhIcroLywcDDtiBqeM0xWztSHBLZPMLc CbOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fn9XDOhzuTqkpjKqRm0fJqtH0d4Ririt6ISxQavGztc=; b=Q+TOj6pE+8T/SLZjj2MDCE5y0xbfxUW7ZzJ9n9Im6w/Ko4syctl0UgGr0NTvlkp4T7 /WeQ18QkEhLWuAHzmIon01M2IjHa2XWg5eCzHFbqnJPIRgXVReTAS87FP33mjfowlTbw eaaGLyZGIWgKEZVWFNo0dT6wx9PAmwEfDt2xNJ4d6BzxnQS1qfE7kWK4ScQygtbRiCMQ 9nk6uMuYH3hsTiWo6zXxA9wORYOk84V9tBaM57JWuSuNMpthwrWrNYWZfrpgfdq2x/gy LPGWvsGgwqj/rSbDyZeaN2/xdvUrtfwdrUVIQ6mIStB8fXJwe0siRzoioNw+MwiQ7j7w DYAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RTEZPHzn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si12177262ejy.142.2021.03.29.01.47.00; Mon, 29 Mar 2021 01:47:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RTEZPHzn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234204AbhC2Ioa (ORCPT + 99 others); Mon, 29 Mar 2021 04:44:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:40920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233560AbhC2I1C (ORCPT ); Mon, 29 Mar 2021 04:27:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 95E5D61477; Mon, 29 Mar 2021 08:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006356; bh=6R+8QI+IYx6C9rN7feoIDmwQmM5836WsWXCSsTemGiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RTEZPHzn6SqOcrvwZBUl1Mburvz3njtyX2x4QLrK2Q37PG9YhrW9D4Ng8n5wTJZtY fbnJB0w4tG6Gh3V1UMw7FDTETN/KSnMpK9ODrMnD1AKz7msz4zQB/8xpHEZdVwsc05 HaRJ+cClD//JfsjL3pD2BaxIPq8tA+eqbuJbcSYw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Matthew Wilcox (Oracle)" , Christoph Hellwig , David Howells , kafs-testing@auristor.com, linux-cachefs@redhat.com, linux-mm@kvack.org Subject: [PATCH 5.10 210/221] fs/cachefiles: Remove wait_bit_key layout dependency Date: Mon, 29 Mar 2021 09:59:01 +0200 Message-Id: <20210329075636.118348118@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox (Oracle) commit 39f985c8f667c80a3d1eb19d31138032fa36b09e upstream. 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: 62906027091f ("mm: add PageWaiters indicating tasks are waiting for a page bit") Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Signed-off-by: David Howells 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] Signed-off-by: Greg Kroah-Hartman --- fs/cachefiles/rdwr.c | 7 +++---- include/linux/pagemap.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c @@ -24,17 +24,16 @@ static int cachefiles_read_waiter(wait_q container_of(wait, struct cachefiles_one_read, monitor); struct cachefiles_object *object; struct fscache_retrieval *op = monitor->op; - struct wait_bit_key *key = _key; + struct wait_page_key *key = _key; struct page *page = wait->private; ASSERT(key); _enter("{%lu},%u,%d,{%p,%u}", monitor->netfs_page->index, mode, sync, - key->flags, key->bit_nr); + key->page, key->bit_nr); - if (key->flags != &page->flags || - key->bit_nr != PG_locked) + if (key->page != page || key->bit_nr != PG_locked) return 0; _debug("--- monitor %p %lx ---", page, page->flags); --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -559,7 +559,6 @@ static inline pgoff_t linear_page_index( return pgoff; } -/* This has the same layout as wait_bit_key - see fs/cachefiles/rdwr.c */ struct wait_page_key { struct page *page; int bit_nr;