Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp240044iob; Wed, 18 May 2022 00:50:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJsLSotNhM2+HVHfI7rllTTDDAEmFNQf36NMmlkCghDRByvAQanF8yfUuTUNr52Ezb5IdZ X-Received: by 2002:a17:90b:2250:b0:1df:665c:79d1 with SMTP id hk16-20020a17090b225000b001df665c79d1mr13199522pjb.220.1652860207334; Wed, 18 May 2022 00:50:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652860207; cv=none; d=google.com; s=arc-20160816; b=s7OMdfhL+7bj6kkZ0eMdok/IbJdRuaQltGormgtVh2O+B3cFeXvzb5c1YR8hDgM6NE DUUlLqBsZbw4Vk8x1qG1xTxcawHfRjuekCa0hw0wnuh0wtok5qBZsqq9H31O9AzdhnY2 Jo+fRdQdLXOoS0fwGrgNnA+vnrgRS/4nzL+0qAe5ie8kc1MBrcwoC1siivSLNEW9KRDU IIn78bd+Z/lqcUZ5alKmuHeZHJWqZTr1kK2iSwrObx7ejgRA8yUBA0T3PX2iqTSVCTFQ XdO/w+8PRlYrSL9REnKaJLxODZ16KgW59pn6QN9kpJuXnWFwcFOOVF3/gGMYyiShIVp8 ukQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=2p+D/WdtUzo7ZNUrDbOnD9yJq+2AeopkckDysa1nz80=; b=URIhq9rf8eNAVg2VELwKNuk+1OvJSqAc6PB1i7wGLhfmKmhYNmJF5oAWsLxo1Zlfh0 JgNNZiPjHYg6q0eYeZ3Qv/AusYmYtvy8uZVVKUx6SGrk4WLFmDC3ZG5qwdnSkn9zOcu8 bnEmsneyc+g+BSRxuGAVWtkjkvFaMLm3X4okxon5CUVggkRgqSljxwCDLKvcy1xCtq6x 0NllVnuFhqVo1nRu2+zhzxY+m/mHwodIjfLT44M+IKAq4QFyd9kYMVm8onbay1yfFC5E tOwMC+kn6qO+Vqn723XY77zLvfxgVvuPsQoKSPwbFi3ULDsfFIPbP+GzQekVBVGUyL45 gqAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=tQCfcPvO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l9-20020a056a0016c900b0050833e85da0si2625813pfc.110.2022.05.18.00.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 00:50:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=tQCfcPvO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6A2DC123891; Wed, 18 May 2022 00:50:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232528AbiERHtj (ORCPT + 99 others); Wed, 18 May 2022 03:49:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232518AbiERHt0 (ORCPT ); Wed, 18 May 2022 03:49:26 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EA991207DE; Wed, 18 May 2022 00:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652860166; x=1684396166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=2p+D/WdtUzo7ZNUrDbOnD9yJq+2AeopkckDysa1nz80=; b=tQCfcPvOz6bnrV7muXGxEVPBWt6WJvrrfLTOEre3u2lkQ8TkOCcAx2t7 XiPj5NJhPPDSdAuaysQOrwJlpYhFBcyE6zrOytBeO5iUKxnCE400PPXo/ yNShTkQSMcSyekk99XrTz2cqTZQFozC8BfhqwJiwcvL9mT0Qeq/09ywMk 0=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 18 May 2022 00:49:25 -0700 X-QCInternal: smtphost Received: from unknown (HELO nasanex01a.na.qualcomm.com) ([10.52.223.231]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2022 00:49:25 -0700 Received: from blr-ubuntu-185.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 18 May 2022 00:49:17 -0700 From: Vivek Kumar To: , , , , , , , , , , , , , CC: , , , , , , , , , , , , , , Vivek Kumar , Prasanna Kumar Subject: [RFC 3/6] block: gendisk: Add a new genhd capability flag Date: Wed, 18 May 2022 13:18:38 +0530 Message-ID: <1652860121-24092-4-git-send-email-quic_vivekuma@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1652860121-24092-1-git-send-email-quic_vivekuma@quicinc.com> References: <1652860121-24092-1-git-send-email-quic_vivekuma@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new genhd capability flag to serialize offsets for swap partition. This flag is enabled for the gendisk of the block device which will be used for saving the snapshot of the hibernation image, based on a kernel parameter "noswap_randomize". Serializing offset in swap partition helps in improving hibernation resume time from bootloader. Signed-off-by: Vivek Kumar Signed-off-by: Prasanna Kumar --- include/linux/blkdev.h | 1 + kernel/power/swap.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1b24c1f..be094e7 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -92,6 +92,7 @@ enum { GENHD_FL_REMOVABLE = 1 << 0, GENHD_FL_HIDDEN = 1 << 1, GENHD_FL_NO_PART = 1 << 2, + GENHD_FL_NO_RANDOMIZE = 1 << 3, }; enum { diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 8d5c811..0a40eda 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c @@ -1526,6 +1526,9 @@ int swsusp_check(void) FMODE_READ | FMODE_EXCL, &holder); if (!IS_ERR(hib_resume_bdev)) { set_blocksize(hib_resume_bdev, PAGE_SIZE); + if (noswap_randomize) + hib_resume_bdev->bd_disk->flags |= + GENHD_FL_NO_RANDOMIZE; clear_page(swsusp_header); error = hib_submit_io(REQ_OP_READ, 0, swsusp_resume_block, -- 2.7.4