From patchwork Tue Feb 18 21:48:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Goyal X-Patchwork-Id: 11389785 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E1B51892 for ; Tue, 18 Feb 2020 21:49:21 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C8E424655 for ; Tue, 18 Feb 2020 21:49:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GgyOVuVe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C8E424655 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582062560; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aQ5H1MbZzQoiO8nmWXg3xfc0Jni+pBy+FpU5y33uLQs=; b=GgyOVuVeMkVhicHQ8ephQ2RMphONi3ejKVD52oUQ4VzMjTCebyeYp3TfTXl9IsjR+/7ZeU iySi6NUwAHpiuxdGbx293sw2G24JusH/lNq0qdAXAUjGWfrdb0xnaRDmuIHuJs5vZZDAo+ yVFcLBmbNqWBtU3U4RKZsYnJNWjMaao= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-55-t4WuzgBIPr64TiO1zqsc_w-1; Tue, 18 Feb 2020 16:49:18 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1F14802564; Tue, 18 Feb 2020 21:49:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA6FB1001B05; Tue, 18 Feb 2020 21:49:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6E98D18089D0; Tue, 18 Feb 2020 21:49:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01ILmuOC020627 for ; Tue, 18 Feb 2020 16:48:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 66DF390526; Tue, 18 Feb 2020 21:48:56 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from horse.redhat.com (unknown [10.18.25.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4557D90089; Tue, 18 Feb 2020 21:48:56 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id AE6712257D7; Tue, 18 Feb 2020 16:48:52 -0500 (EST) From: Vivek Goyal To: linux-fsdevel@vger.kernel.org, linux-nvdimm@lists.01.org, hch@infradead.org, dan.j.williams@intel.com Date: Tue, 18 Feb 2020 16:48:38 -0500 Message-Id: <20200218214841.10076-6-vgoyal@redhat.com> In-Reply-To: <20200218214841.10076-1-vgoyal@redhat.com> References: <20200218214841.10076-1-vgoyal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: vishal.l.verma@intel.com, dm-devel@redhat.com, Gerald Schaefer , vgoyal@redhat.com, linux-s390@vger.kernel.org Subject: [dm-devel] [PATCH v5 5/8] s390, dcssblk, dax: Add dax zero_page_range operation to dcssblk driver X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: t4WuzgBIPr64TiO1zqsc_w-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Add dax operation zero_page_range for dcssblk driver. CC: linux-s390@vger.kernel.org Suggested-by: Christoph Hellwig Reviewed-by: Gerald Schaefer Signed-off-by: Vivek Goyal --- drivers/s390/block/dcssblk.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 63502ca537eb..331abab5d066 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -57,11 +57,28 @@ static size_t dcssblk_dax_copy_to_iter(struct dax_device *dax_dev, return copy_to_iter(addr, bytes, i); } +static int dcssblk_dax_zero_page_range(struct dax_device *dax_dev, u64 offset, + size_t len) +{ + long rc; + void *kaddr; + pgoff_t pgoff = offset >> PAGE_SHIFT; + unsigned page_offset = offset_in_page(offset); + + rc = dax_direct_access(dax_dev, pgoff, 1, &kaddr, NULL); + if (rc < 0) + return rc; + memset(kaddr + page_offset, 0, len); + dax_flush(dax_dev, kaddr + page_offset, len); + return 0; +} + static const struct dax_operations dcssblk_dax_ops = { .direct_access = dcssblk_dax_direct_access, .dax_supported = generic_fsdax_supported, .copy_from_iter = dcssblk_dax_copy_from_iter, .copy_to_iter = dcssblk_dax_copy_to_iter, + .zero_page_range = dcssblk_dax_zero_page_range, }; struct dcssblk_dev_info {