From patchwork Fri Jul 19 15:50:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 1134139 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=brauner.io Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=brauner.io header.i=@brauner.io header.b="WMPpRWy7"; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45qwVZ5qg0z9s4Y; Sat, 20 Jul 2019 01:52:06 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hoVAx-0005jf-9g; Fri, 19 Jul 2019 15:52:03 +0000 Received: from mail-wr1-f65.google.com ([209.85.221.65]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1hoVAw-0005jM-1m for kernel-team@lists.ubuntu.com; Fri, 19 Jul 2019 15:52:02 +0000 Received: by mail-wr1-f65.google.com with SMTP id z1so32709952wru.13 for ; Fri, 19 Jul 2019 08:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J8I4UPlPSRLln+CxuHentqdZ/kJLnZkMCBlgZwv3HmU=; b=WMPpRWy7Do6TPU9u0rSZKMk6KEWAJdVyhPou15kRrqC1FCBMBuvdSfzhoGQpjrkbnB yCmJd0HqG5ekywh+IYCmY/rBLHr3cwkBSrSDtXrZ8f53O/RwqJDBJTe2GwIkx+okP7Mt fIyS0Pw0g6BQhc1lFcQRjsnMVKBuinC6juznnWb0JNjQ1DkpCJV9/WscON++KIiRDWlB Fn433YdJt+WneAMVtiMJqXl+S1NvvJ9J/4uY5X0vRu/9N4L1gXdfir9wR0pIwRzrVb88 3QUT1DPwLLxb8DhxG19+MDujdkfHWSPnlGTlbLqZzpCk/asNaVofCbYcTf5sllnXOtx8 ZXCw== 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=J8I4UPlPSRLln+CxuHentqdZ/kJLnZkMCBlgZwv3HmU=; b=syCYE/Ik0/2QBWsoZCHLOntMTha732+L96dB7Re9mDacP8HqU7ew7X8NVsm0+LaVVW WemUk2DIqd1nvfOzUkmZN5ZHLH2rDblLe+9jU3pYGtZPc7NaC4Us57PwiAClqwIfR+uu bUin8Qma6qDOnneSiNkpel1n/aEh1toSfNQWr6vdda81WLScOsunbi6dtFrJe3FYW55M A57VGvKFGN8TDChqK1GGQqnkttpe/MCTXAuc0SzLb3AsglVCo1zhx0wByVxWXpEw6Z+O 0k4bkbOltwvBSzL51qYcB4jMHLbwDDZpeGzASeftIs4dCYp0pgG7JihvqlMdTCW2IwWi waHA== X-Gm-Message-State: APjAAAWLATHfpO9xfC1sqSgMj1VsGRxL3MpOoiIP1KHSqUjM3WUhLUn2 SDasQPebFt3oxpI9pNAhEg9x/JFCOXw= X-Google-Smtp-Source: APXvYqxDaHikyCAuBFNBf4UJ1wNC2n3PpIk1bRI+wwyJadAjqNiACyV2gEZFSRVFFORQKyWh4gv/RA== X-Received: by 2002:adf:afe2:: with SMTP id y34mr55567322wrd.250.1563551521459; Fri, 19 Jul 2019 08:52:01 -0700 (PDT) Received: from localhost.localdomain (p5097b50e.dip0.t-ipconnect.de. [80.151.181.14]) by smtp.gmail.com with ESMTPSA id x24sm31100482wmh.5.2019.07.19.08.52.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 19 Jul 2019 08:52:00 -0700 (PDT) From: Christian Brauner X-Google-Original-From: Christian Brauner To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2][SRU][Disco] UBUNTU: SAUCE: shiftfs: add O_DIRECT support Date: Fri, 19 Jul 2019 17:50:46 +0200 Message-Id: <20190719155047.5885-2-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190719155047.5885-1-christian.brauner@ubuntu.com> References: <20190719155047.5885-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: free.ekanayaka@canonical.com, stgraber@ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1837223 This enabled O_DIRECT support for shiftfs if the underlay supports it. Currently shiftfs does not handle O_DIRECT if the underlay supports it. This is blocking dqlite - an essential part of LXD - from profiting from the performance benefits of O_DIRECT on suitable filesystems when used with async io such as aio or io_uring. Overlayfs cannot support this directly since the upper filesystem in overlay can be any filesystem. So if the upper filesystem does not support O_DIRECT but the lower filesystem does you're out of luck. Shiftfs does not suffer from the same problem since there is not concept of an upper filesystem in the same way that overlayfs has it. Essentially, shiftfs is a transparent shim relaying everything to the underlay while overlayfs' upper layer is not (completely). Cc: Seth Forshee Signed-off-by: Christian Brauner --- fs/shiftfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/shiftfs.c b/fs/shiftfs.c index 49f6714e9f95..addaa6e21e57 100644 --- a/fs/shiftfs.c +++ b/fs/shiftfs.c @@ -1126,6 +1126,9 @@ static int shiftfs_open(struct inode *inode, struct file *file) } file->private_data = file_info; + /* For O_DIRECT dentry_open() checks f_mapping->a_ops->direct_IO. */ + file->f_mapping = realfile->f_mapping; + file_info->realfile = realfile; return 0; }