Received: by 2002:a25:d80d:0:0:0:0:0 with SMTP id p13csp218668ybg; Sat, 23 May 2020 12:02:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkRSH3Bwn35RldgaI3Ca0z4Tbwape6wHyzPwK4XuKADV16PH8vFQvwHuKVWVreU/pUBc5/ X-Received: by 2002:a05:6402:6c1:: with SMTP id n1mr8308920edy.199.1590260547524; Sat, 23 May 2020 12:02:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590260547; cv=none; d=google.com; s=arc-20160816; b=gP0uPZhkus/ps3SvpzRous8C1HiOPbEjpth41/eVF4uxGTZzUyMbaz2FbwEQ+5lGCx 0keN7c+bzAU5TmPl4xM+KYJ5Zd9si/NS8lhQ///UZGKYaBqMFZA3db1nACT4bNj80WQD kB7dsiqz8MNvJnIj0gBWkrYIZzOqMPB23NsOtHOwgT74HFPY4lKyDpHetI4HCQ/4/F3c RVTOS6RgD+vGOBITgwkO5Mp90Xznbe7pVnI9Y4Y7xYRVOiFs1GbbPHyPQpL4kTbGhRu0 iuBBQeyL+5QOsfoIt+kII1sjjT0XLWh79cyNc+in35mVX0F3R9J8sF4fylvuLDfrvKF+ dBDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dAoC2D0g8n2nB3lVHnvM8l1E4Q5NdmCRN9F9KiRIdEU=; b=PeY+y7VUu1GUa7LplOsWIvzTYaMx+trN6qzQelasZ0f96PurlAD7BanHF8zCBEr8vK v1zBHfZKxG2ZI4/bG78+cFnBy15e2v6Tv1yF0vzxW+enq2ctDtSO0TtnKOYQBoi7rexK lJ6NtRuq9vsySebRR+m0gJTf8aZKt1TveUs1mSFiZxs6/KmcHEJm35KR57Z7uRk3KeIT u3rVqG/kH7dV1WFZ1SreZcPZOVZL75g2yEc+5siqHAy6dGonuVRrmWabuuhZUp+79OkR +vtnuyoXdwvkxz5hjIou12Xitg77F6K+8T4ekt7fceRxrWxC4WDUJAqKkpPLBM/iUnFf GSPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=YC2Vfzsn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z97si6727530ede.412.2020.05.23.12.02.05; Sat, 23 May 2020 12:02:27 -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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=YC2Vfzsn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387937AbgEWS6U (ORCPT + 99 others); Sat, 23 May 2020 14:58:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729149AbgEWS6O (ORCPT ); Sat, 23 May 2020 14:58:14 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4864C061A0E for ; Sat, 23 May 2020 11:58:13 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id w20so1561624pga.6 for ; Sat, 23 May 2020 11:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dAoC2D0g8n2nB3lVHnvM8l1E4Q5NdmCRN9F9KiRIdEU=; b=YC2VfzsnPeRpcE5DvmH1q7hRFR3ktyWmEBg1dhSrxX6BFoyD3fKdg4R2GLI95N/SE0 13pLuYLICLL5TpTf7k8tOQCbfcWAg+LSSWYlWJ1suwm0ov6o2L9xiYsqhC/dE4f5VSym icycAN5rixlSrfpPHHd9LLwl47FKj5W+W548LOgLrXWRYNWFtPZlt+gcRvbc5/F/zgL6 1FxFTEntDu/QcaUTMefGTsOHV6kxxyLa9N7whilVJyvdprYWKH11tzgAocRoJwCMs5sJ ORD5W6XVt276+iM8eGWGAHYZvutwMyV1kO9mZPyzKTsoS0Iqcx9DKWbS0Jhs1iPon9fh nHHw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=dAoC2D0g8n2nB3lVHnvM8l1E4Q5NdmCRN9F9KiRIdEU=; b=lyVDikp9YGw37DmCUymA1cbFrANsmvHX9odGX/C21dczXJX1m/P2wbxzqzTPyvy1kJ NgTPzo7YcQASlM6vV9W4yMzqTiQ9WxurmisVPuRClrCS1GDakKuctkpWSFBrTMuUy0m0 T4CFaQLoCcxeV+xbIBcOHQPGLPmbRq/hgQ4wFhYKpzF0VWzuFApQcj3VSFqCrzgqTcIn 9DBARBwJzAgCjlPaRi87YEaLW82Ch5+JwGS3mLmQzLoDTZskQ8EVzrI47z/pdImh5A4D UI7/yFSCJP4/FDbp+Ed6gOvkzZ++gGm+9v2m0ZNP+N5Jfj/GkC+8HsagxYHFcRFLDf+Y 8uLw== X-Gm-Message-State: AOAM533TF3CGJ5XlExotO4GnieCBSrP1WXiq3o8M2NfGWhjcofH2VWhb h1uadP20RNCpWVXd0ZBKnDiaEw== X-Received: by 2002:a62:b618:: with SMTP id j24mr9943370pff.16.1590260293462; Sat, 23 May 2020 11:58:13 -0700 (PDT) Received: from x1.lan ([2605:e000:100e:8c61:c94:a67a:9209:cf5f]) by smtp.gmail.com with ESMTPSA id 25sm9297319pjk.50.2020.05.23.11.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 11:58:12 -0700 (PDT) From: Jens Axboe To: io-uring@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Jens Axboe Subject: [PATCH 11/12] mm: add kiocb_wait_page_queue_init() helper Date: Sat, 23 May 2020 12:57:54 -0600 Message-Id: <20200523185755.8494-12-axboe@kernel.dk> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200523185755.8494-1-axboe@kernel.dk> References: <20200523185755.8494-1-axboe@kernel.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Checks if the file supports it, and initializes the values that we need. Caller passes in 'data' pointer, if any, and the callback function to be used. Signed-off-by: Jens Axboe --- include/linux/pagemap.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index d3e63c9c61ae..def58de92053 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -493,6 +493,24 @@ static inline int wake_page_match(struct wait_page_queue *wait_page, return 1; } +static inline int kiocb_wait_page_queue_init(struct kiocb *kiocb, + struct wait_page_queue *wait, + wait_queue_func_t func, + void *data) +{ + if (kiocb->ki_filp->f_mode & FMODE_BUF_RASYNC) { + wait->wait.func = func; + wait->wait.private = data; + wait->wait.flags = 0; + INIT_LIST_HEAD(&wait->wait.entry); + kiocb->ki_flags |= IOCB_WAITQ; + kiocb->private = wait; + return 0; + } + + return -EOPNOTSUPP; +} + extern void __lock_page(struct page *page); extern int __lock_page_killable(struct page *page); extern int __lock_page_async(struct page *page, struct wait_page_queue *wait); -- 2.26.2