From patchwork Mon Feb 17 18:16:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Goyal X-Patchwork-Id: 11387123 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 2F80B924 for ; Mon, 17 Feb 2020 18:17:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F60A214D8 for ; Mon, 17 Feb 2020 18:17:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KhX5PiR8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729866AbgBQSRS (ORCPT ); Mon, 17 Feb 2020 13:17:18 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:30117 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729859AbgBQSRR (ORCPT ); Mon, 17 Feb 2020 13:17:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581963437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cnevXfGVEDsFBctQatqNzlbLF8HNLGY3ShXMHssDWiQ=; b=KhX5PiR8Am5FR7zU1374dmWj/++WjvTlzY2KBSgOSVHgFlEoxk9S58e33/O8IefwH+fOok ZOD+ARr+yVGsnJykGlgwzxD5T7Rua37WmneVyRyrwI9DBnnonI1tIaSDV2S3re3m2VrBOQ AOHfPUYxvIpWNwxPCR61KOY9uEuDwm0= 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-104-dmSXdQaTPBOZm99vJnhJ6w-1; Mon, 17 Feb 2020 13:17:12 -0500 X-MC-Unique: dmSXdQaTPBOZm99vJnhJ6w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72677100DFDC; Mon, 17 Feb 2020 18:17:11 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 719635DA84; Mon, 17 Feb 2020 18:17:08 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 106712257D6; Mon, 17 Feb 2020 13:17:08 -0500 (EST) From: Vivek Goyal To: linux-fsdevel@vger.kernel.org, linux-nvdimm@lists.01.org, hch@infradead.org, dan.j.williams@intel.com Cc: dm-devel@redhat.com, vishal.l.verma@intel.com, vgoyal@redhat.com, linux-s390@vger.kernel.org, Gerald Schaefer Subject: [PATCH v4 4/7] s390,dcssblk,dax: Add dax zero_page_range operation to dcssblk driver Date: Mon, 17 Feb 2020 13:16:50 -0500 Message-Id: <20200217181653.4706-5-vgoyal@redhat.com> In-Reply-To: <20200217181653.4706-1-vgoyal@redhat.com> References: <20200217181653.4706-1-vgoyal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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 {