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.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, 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 B76E8C433DF for ; Sat, 22 Aug 2020 09:03:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 35BDC20825 for ; Sat, 22 Aug 2020 09:03:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YtNKOKUE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35BDC20825 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 666438D000B; Sat, 22 Aug 2020 05:03:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6171A8D0008; Sat, 22 Aug 2020 05:03:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5078B8D000B; Sat, 22 Aug 2020 05:03:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id 388578D0008 for ; Sat, 22 Aug 2020 05:03:01 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E3C9A248F for ; Sat, 22 Aug 2020 09:03:00 +0000 (UTC) X-FDA: 77177614920.06.vein88_301847b27040 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id B570410048EED for ; Sat, 22 Aug 2020 09:03:00 +0000 (UTC) X-HE-Tag: vein88_301847b27040 X-Filterd-Recvd-Size: 6652 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Sat, 22 Aug 2020 09:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598086978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type; bh=A2WK+odm/xLarW17J7+toz/4bY7f8TVl8y0DPG0SgCM=; b=YtNKOKUEYLES1eh4HGslwOWQT+cWwwzh2vGmhxtoHzFtgdJZ3DgZWnvoU8PEVlS2p+Xdz/ wuKiToJgjGuUd38rj0KEQkK2rqh1y5qazFHjfyiFGYAPUyrdDF5zvg6c4K0ENcWGuM6tL/ 47laGUkWJaPcmYLGmLUyz5kjVuG1l8M= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-13KjTVBLOKSJnB2y7TyFBg-1; Sat, 22 Aug 2020 05:02:54 -0400 X-MC-Unique: 13KjTVBLOKSJnB2y7TyFBg-1 Received: by mail-pl1-f200.google.com with SMTP id h6so2558667plt.0 for ; Sat, 22 Aug 2020 02:02:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=A2WK+odm/xLarW17J7+toz/4bY7f8TVl8y0DPG0SgCM=; b=WWrNIMJq4itqnI9bYSw7aH8afTIdeOAe8J1poW9ihGQkTg4Cwle1XWSlDLSFPjrG+d /uV2Do19pzXJd6U9N5hDVvBH+Cime7CJMjNT0sJOtl9zESHEaFvsk4mXcM2KR0fjYLsu l9EzdYsVth9z3FFH+vhDGrHnP/t5J/qi2glZbqW7QVovFlpINok8ZusvRffZgPcr8XcJ k5GvfX4CKTZztfNF7A5YnXJ39uL9V9j8H5imvxsaLcB+5Pc0BHUG7/sG6EEnlVdkJhNV y1W1GvW9eoquKU5jGfY/j7LxvAyddf2+Vaqyq9ArS0Pm6DoFzzhb1uCmvLgvCoto+W06 2euw== X-Gm-Message-State: AOAM5326QzMMvmlh8O8BvQOo6hwReqfeYSfM/qD3rgtemw+qshNta1Ef K2RYSPM62ZhcXN2tVtZ6A21x5K/ZhVlNWrdi39G2CSzuJLMrH4dfqMY4CD0TTGrmAP2ZKUz7v++ br6llHVjzkmI= X-Received: by 2002:a17:90a:a401:: with SMTP id y1mr5681302pjp.199.1598086972288; Sat, 22 Aug 2020 02:02:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE3TlY0agf/LpfwoxRlqSwc0vYF9UraA5RD84nzYV03YvPzcs2nnflzpIOMCv9ttFlrFpIGw== X-Received: by 2002:a17:90a:a401:: with SMTP id y1mr5681286pjp.199.1598086971994; Sat, 22 Aug 2020 02:02:51 -0700 (PDT) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id m190sm351571pfm.184.2020.08.22.02.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Aug 2020 02:02:51 -0700 (PDT) From: Gao Xiang To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Gao Xiang Subject: [PATCH] swap: rename SWP_FS to SWAP_FS_OPS to avoid ambiguity Date: Sat, 22 Aug 2020 17:02:08 +0800 Message-Id: <20200822090208.24212-1-hsiangkao@redhat.com> X-Mailer: git-send-email 2.18.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hsiangkao@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: B570410048EED X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: SWP_FS is used to make swap_{read,write}page() go through the filesystem, and it's only used for swap files over NFS for now. Otherwise it will directly submit IO to blockdev according to swapfile extents reported by filesystems in advance. As Matthew pointed out [1], SWP_FS naming is somewhat confusing, so let's rename to SWP_FS_OPS. [1] https://lore.kernel.org/r/20200820113448.GM17456@casper.infradead.org Suggested-by: Matthew Wilcox Signed-off-by: Gao Xiang --- A follow-on thread / patch here. include/linux/swap.h | 2 +- mm/page_io.c | 6 +++--- mm/swap_state.c | 2 +- mm/swapfile.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 7eb59bc552a5..51029a5f57be 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -170,7 +170,7 @@ enum { SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */ SWP_BLKDEV = (1 << 6), /* its a block device */ SWP_ACTIVATED = (1 << 7), /* set after swap_activate success */ - SWP_FS = (1 << 8), /* swap file goes through fs */ + SWP_FS_OPS = (1 << 8), /* swapfile operations go through fs */ SWP_AREA_DISCARD = (1 << 9), /* single-time swap area discards */ SWP_PAGE_DISCARD = (1 << 10), /* freed swap page-cluster discards */ SWP_STABLE_WRITES = (1 << 11), /* no overwrite PG_writeback pages */ diff --git a/mm/page_io.c b/mm/page_io.c index 9e362567d454..72e0b5a5a41f 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -302,7 +302,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc, struct swap_info_struct *sis = page_swap_info(page); VM_BUG_ON_PAGE(!PageSwapCache(page), page); - if (sis->flags & SWP_FS) { + if (sis->flags & SWP_FS_OPS) { struct kiocb kiocb; struct file *swap_file = sis->swap_file; struct address_space *mapping = swap_file->f_mapping; @@ -393,7 +393,7 @@ int swap_readpage(struct page *page, bool synchronous) goto out; } - if (sis->flags & SWP_FS) { + if (sis->flags & SWP_FS_OPS) { struct file *swap_file = sis->swap_file; struct address_space *mapping = swap_file->f_mapping; @@ -455,7 +455,7 @@ int swap_set_page_dirty(struct page *page) { struct swap_info_struct *sis = page_swap_info(page); - if (sis->flags & SWP_FS) { + if (sis->flags & SWP_FS_OPS) { struct address_space *mapping = sis->swap_file->f_mapping; VM_BUG_ON_PAGE(!PageSwapCache(page), page); diff --git a/mm/swap_state.c b/mm/swap_state.c index e82f4f8b1f63..135a5d9fad5d 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -573,7 +573,7 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, goto skip; /* Test swap type to make sure the dereference is safe */ - if (likely(si->flags & (SWP_BLKDEV | SWP_FS))) { + if (likely(si->flags & (SWP_BLKDEV | SWP_FS_OPS))) { struct inode *inode = si->swap_file->f_mapping->host; if (inode_read_congested(inode)) goto skip; diff --git a/mm/swapfile.c b/mm/swapfile.c index 2937daf3ca02..75681682bec8 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2426,7 +2426,7 @@ static int setup_swap_extents(struct swap_info_struct *sis, sector_t *span) if (ret >= 0) sis->flags |= SWP_ACTIVATED; if (!ret) { - sis->flags |= SWP_FS; + sis->flags |= SWP_FS_OPS; ret = add_swap_extent(sis, 0, sis->max, 0); *span = sis->pages; } -- 2.18.1