Received: by 10.192.165.156 with SMTP id m28csp2080167imm; Thu, 12 Apr 2018 08:17:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ZAk+/zZhBmY63XfAhA7gXutx/Wd+S77pf92J+n4jq3dL+W09tbRBj5AkaJrRKKlDOiM9S X-Received: by 2002:a17:902:44c:: with SMTP id 70-v6mr1508442ple.354.1523546237694; Thu, 12 Apr 2018 08:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523546237; cv=none; d=google.com; s=arc-20160816; b=AT0WVdrLwRCtS7Rp8wcC+OPWauG+WH5gK92W081GRmy3s3oawSzmVjQfc70f3b3tUZ LN9PVOGauXlUe3tisRmSndekwhxCLvvUZg0wMzB4gq+GoZ5goInTbUC96B+UaDqdwcGV oGJ7f/WFzyzsWipN51Tn7PRNrvYvIGI318Nz2jlKyDrUp+FBKdi85Xsnw2Q9h7Ivu+Y1 jWdCMobPWYLYVPrLkGwaMyMqjFIwPsDbb/KPbikP688PT9iwEtUVGcvlRbn6eQkngoAR 9HJxyykL06FPwbcLHZRXXfnIDpA7PS6ULru+qnNawP/JPrBHjyB1Bp30otZz9xjwkMSM B3cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=E3v1I/C8FIzl227nlxteK2UWpwdarGcNfRYeFQHCZxM=; b=XdyI8OL+d+/XB5NWDPIKXI8BnuBMnL/lEq9nsYTLFGEMSUkXBUOHORbJ1cfBel6fc4 BC/rVl3FE0dMNnT82kx0otmQABqoyX9VDQFODWENwaGZlhUXzFvi6VTHK/5icdHuQrPI tt/2vgXI86p2/PkfuW1goq6f+mdewhqtxVeumc4LDKaNDtzaJqbCVf8BcCsfkaBVEtBs P/lQozRI7qpbH5Mkw1TxmC/JSGNIANYEBLki9BOVMLMmzh7bcJfRAsSaD5ZTk5fSNksf W8UjRGHVN1OLtVLEZUfTV4LfWO2RkIY26BtMOSoJc5drSl4bTm4OeD0EFHO4V5ow28l/ JXSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22si2360341pgv.684.2018.04.12.08.16.40; Thu, 12 Apr 2018 08:17:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753628AbeDLPJA (ORCPT + 99 others); Thu, 12 Apr 2018 11:09:00 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:46456 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753411AbeDLPIw (ORCPT ); Thu, 12 Apr 2018 11:08:52 -0400 Received: by mail-wr0-f194.google.com with SMTP id d1so5453225wrj.13 for ; Thu, 12 Apr 2018 08:08:52 -0700 (PDT) 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; bh=E3v1I/C8FIzl227nlxteK2UWpwdarGcNfRYeFQHCZxM=; b=shoYE054BljtTXDYvTIOSJtIBvKgfGFIitaTrlBbYGxIPBCpvrFaxLBiwM9A/d18zL 8zi15+epZEkGBomqvvhXHJWOPb04/iwOkpbClUjEEd7L0kZnsk6lo0zcwNqmrhrR5AJW YSDJ8Gb0VvPntJjd3hE+xvdYoQ2A3/MbDFOKh/dRSu7APgDquLqEuyuGhz4mnnsyuV5M IBL285JZ4L0PoWcKJWu2Rpbt9v5fseWjSnfdHIbPHalx6bNetNdXWlvAvYq1l9zi9FXQ V2RUgaIikSQOlsmVeyd92vO22MBHwEdXnc4kVgYZblv0CetQ+p5QldgcKa+5CKipjSGp Ey8Q== X-Gm-Message-State: ALQs6tA7pEyaw6hSel5mVPeXvbJwfD4IXumsfrcgDeNovMsV+9/CEQz4 nT1M3a/6DY2WdddjlTbYpftaPQ== X-Received: by 10.223.135.155 with SMTP id b27mr1081253wrb.119.1523545731411; Thu, 12 Apr 2018 08:08:51 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-176-63-54-97.catv.broadband.hu. [176.63.54.97]) by smtp.gmail.com with ESMTPSA id p197sm2621783wme.43.2018.04.12.08.08.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Apr 2018 08:08:50 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 17/35] ovl: readd fiemap Date: Thu, 12 Apr 2018 17:08:08 +0200 Message-Id: <20180412150826.20988-18-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180412150826.20988-1-mszeredi@redhat.com> References: <20180412150826.20988-1-mszeredi@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement stacked fiemap(). Need to split inode operations for regular file (which has fiemap) and special file (which doesn't have fiemap). Signed-off-by: Miklos Szeredi --- fs/overlayfs/inode.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index 3b996639e1ad..b723327501f7 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -455,6 +455,23 @@ int ovl_update_time(struct inode *inode, struct timespec *ts, int flags) return 0; } +static int ovl_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, + u64 start, u64 len) +{ + int err; + struct inode *realinode = ovl_inode_real(inode); + const struct cred *old_cred; + + if (!realinode->i_op->fiemap) + return -EOPNOTSUPP; + + old_cred = ovl_override_creds(inode->i_sb); + err = realinode->i_op->fiemap(realinode, fieinfo, start, len); + revert_creds(old_cred); + + return err; +} + static const struct inode_operations ovl_file_inode_operations = { .setattr = ovl_setattr, .permission = ovl_permission, @@ -462,6 +479,7 @@ static const struct inode_operations ovl_file_inode_operations = { .listxattr = ovl_listxattr, .get_acl = ovl_get_acl, .update_time = ovl_update_time, + .fiemap = ovl_fiemap, }; static const struct inode_operations ovl_symlink_inode_operations = { @@ -472,6 +490,15 @@ static const struct inode_operations ovl_symlink_inode_operations = { .update_time = ovl_update_time, }; +static const struct inode_operations ovl_special_inode_operations = { + .setattr = ovl_setattr, + .permission = ovl_permission, + .getattr = ovl_getattr, + .listxattr = ovl_listxattr, + .get_acl = ovl_get_acl, + .update_time = ovl_update_time, +}; + /* * It is possible to stack overlayfs instance on top of another * overlayfs instance as lower layer. We need to annonate the @@ -555,7 +582,7 @@ static void ovl_fill_inode(struct inode *inode, umode_t mode, dev_t rdev, break; default: - inode->i_op = &ovl_file_inode_operations; + inode->i_op = &ovl_special_inode_operations; init_special_inode(inode, mode, rdev); break; } -- 2.14.3