From patchwork Tue Apr 2 15:44:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10881887 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF1A713B5 for ; Tue, 2 Apr 2019 15:44:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92E582015F for ; Tue, 2 Apr 2019 15:44:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87590287A6; Tue, 2 Apr 2019 15:44:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38C7D2015F for ; Tue, 2 Apr 2019 15:44:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729322AbfDBPol (ORCPT ); Tue, 2 Apr 2019 11:44:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39940 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbfDBPol (ORCPT ); Tue, 2 Apr 2019 11:44:41 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 8DD7D3082B46 for ; Tue, 2 Apr 2019 15:44:41 +0000 (UTC) Received: from [IPv6:::1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 774311092003; Tue, 2 Apr 2019 15:44:39 +0000 (UTC) To: linux-xfs From: Eric Sandeen Subject: [PATCH] xfs: return correct XFS_IOC_DIOINFO for DAX inode Cc: Jeff Moyer Message-ID: Date: Tue, 2 Apr 2019 10:44:38 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 02 Apr 2019 15:44:41 +0000 (UTC) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pmem is byte addressable, and indeed byte-aligned DIO works on a DAX file. So, teach XFS_IOC_DIOINFO to return the correct alignment information if IS_DAX(inode). Signed-off-by: Eric Sandeen diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 6ecdbb3..35eae7d 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1919,12 +1919,21 @@ xfs_file_ioctl( } case XFS_IOC_DIOINFO: { struct dioattr da; - xfs_buftarg_t *target = - XFS_IS_REALTIME_INODE(ip) ? - mp->m_rtdev_targp : mp->m_ddev_targp; - da.d_mem = da.d_miniosz = target->bt_logical_sectorsize; - da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1); + if (IS_DAX(inode)) { + /* pmem is byte addressable */ + da.d_mem = 1; + da.d_miniosz = 1; + da.d_maxiosz = INT_MAX; + } else { + xfs_buftarg_t *target = + XFS_IS_REALTIME_INODE(ip) ? + mp->m_rtdev_targp : mp->m_ddev_targp; + + da.d_mem = target->bt_logical_sectorsize; + da.d_miniosz = target->bt_logical_sectorsize; + da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1); + } if (copy_to_user(arg, &da, sizeof(da))) return -EFAULT;