From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73243C43468 for ; Mon, 21 Sep 2020 07:20:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F14692085B for ; Mon, 21 Sep 2020 07:20:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="MSbsjpqn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F14692085B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BA85490002D; Mon, 21 Sep 2020 03:20:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B3059900029; Mon, 21 Sep 2020 03:20:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4C0690002D; Mon, 21 Sep 2020 03:20:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id 7E770900029 for ; Mon, 21 Sep 2020 03:20:17 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 35F8C1EE6 for ; Mon, 21 Sep 2020 07:20:17 +0000 (UTC) X-FDA: 77286220074.16.start24_3c1283527143 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 17609100E691F for ; Mon, 21 Sep 2020 07:20:17 +0000 (UTC) X-HE-Tag: start24_3c1283527143 X-Filterd-Recvd-Size: 5197 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Sep 2020 07:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=bs3s4CPMxEz5X0bUCuI32A3H5OpcszVLrlRWt3O1ueE=; b=MSbsjpqnWQ/2w9cNiudT74OOJV /J8kza/mqlfwkNzvfQdGHI07f5kfrB1t/fTpfBKuplmcgGO+bm0rZ6mZBz9KqyBSvohb3OV9wRbb0 pYdtu9BhEWwoktToI59WPUqELsgNPhMizo0fVEiBfiBspuToMAk6psHFgBRNOpEH2YPbQ2Slyh4I1 mesQcOYg57pPm9k1KaQq1uGmomrB7QkqnDlQVwntHjp7Hl/sPmEW4REilOC2aTzR6EzbpSy1ez93u NWnUcn3l3z5+8q+OVHiPRGV7R/yegSFL/RnQaoG4i8mvvdieSPsIFWFtRjH/1Ixk0OUN0FgZoEvWl yS9fFgtQ==; Received: from p4fdb0c34.dip0.t-ipconnect.de ([79.219.12.52] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKG7F-0003Fs-Lv; Mon, 21 Sep 2020 07:20:01 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Josef Bacik , Minchan Kim , Stefan Haberland , Jan Hoeppner , Joseph Qi , "Rafael J. Wysocki" , Pavel Machek , Len Brown , Andrew Morton , linux-kernel@vger.kernel.org, nbd@other.debian.org, linux-ide@vger.kernel.org, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-pm@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, "Rafael J . Wysocki" Subject: [PATCH 11/14] PM: rewrite is_hibernate_resume_dev to not require an inode Date: Mon, 21 Sep 2020 09:19:55 +0200 Message-Id: <20200921071958.307589-12-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921071958.307589-1-hch@lst.de> References: <20200921071958.307589-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Just check the dev_t to help simplifying the code. Signed-off-by: Christoph Hellwig Acked-by: Rafael J. Wysocki --- fs/block_dev.c | 2 +- include/linux/suspend.h | 4 ++-- kernel/power/user.c | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 1a9325f4315769..2898d69be6b3e4 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1885,7 +1885,7 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struc= t iov_iter *from) if (bdev_read_only(I_BDEV(bd_inode))) return -EPERM; =20 - if (IS_SWAPFILE(bd_inode) && !is_hibernate_resume_dev(bd_inode)) + if (IS_SWAPFILE(bd_inode) && !is_hibernate_resume_dev(bd_inode->i_rdev)= ) return -ETXTBSY; =20 if (!iov_iter_count(from)) diff --git a/include/linux/suspend.h b/include/linux/suspend.h index cb9afad82a90c8..8af13ba60c7e45 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -473,9 +473,9 @@ static inline int hibernate_quiet_exec(int (*func)(vo= id *data), void *data) { #endif /* CONFIG_HIBERNATION */ =20 #ifdef CONFIG_HIBERNATION_SNAPSHOT_DEV -int is_hibernate_resume_dev(const struct inode *); +int is_hibernate_resume_dev(dev_t dev); #else -static inline int is_hibernate_resume_dev(const struct inode *i) { retur= n 0; } +static inline int is_hibernate_resume_dev(dev_t dev) { return 0; } #endif =20 /* Hibernation and suspend events */ diff --git a/kernel/power/user.c b/kernel/power/user.c index d5eedc2baa2a10..b5815685b944fe 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -35,12 +35,12 @@ static struct snapshot_data { bool ready; bool platform_support; bool free_bitmaps; - struct inode *bd_inode; + dev_t dev; } snapshot_state; =20 -int is_hibernate_resume_dev(const struct inode *bd_inode) +int is_hibernate_resume_dev(dev_t dev) { - return hibernation_available() && snapshot_state.bd_inode =3D=3D bd_ino= de; + return hibernation_available() && snapshot_state.dev =3D=3D dev; } =20 static int snapshot_open(struct inode *inode, struct file *filp) @@ -101,7 +101,7 @@ static int snapshot_open(struct inode *inode, struct = file *filp) data->frozen =3D false; data->ready =3D false; data->platform_support =3D false; - data->bd_inode =3D NULL; + data->dev =3D 0; =20 Unlock: unlock_system_sleep(); @@ -117,7 +117,7 @@ static int snapshot_release(struct inode *inode, stru= ct file *filp) =20 swsusp_free(); data =3D filp->private_data; - data->bd_inode =3D NULL; + data->dev =3D 0; free_all_swap_pages(data->swap); if (data->frozen) { pm_restore_gfp_mask(); @@ -245,7 +245,7 @@ static int snapshot_set_swap_area(struct snapshot_dat= a *data, if (data->swap < 0) return -ENODEV; =20 - data->bd_inode =3D bdev->bd_inode; + data->dev =3D bdev->bd_dev; bdput(bdev); return 0; } --=20 2.28.0