From patchwork Thu May 31 16:36:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Brandenburg X-Patchwork-Id: 10441369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3D2CB602BF for ; Thu, 31 May 2018 16:37:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B4F3289AD for ; Thu, 31 May 2018 16:37:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E1DC28F56; Thu, 31 May 2018 16:37:29 +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,DKIM_SIGNED, DKIM_VALID, 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 88622289AD for ; Thu, 31 May 2018 16:37:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755594AbeEaQh0 (ORCPT ); Thu, 31 May 2018 12:37:26 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:42345 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755742AbeEaQhX (ORCPT ); Thu, 31 May 2018 12:37:23 -0400 Received: by mail-qt0-f193.google.com with SMTP id c2-v6so28597413qtn.9 for ; Thu, 31 May 2018 09:37:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omnibond-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yegkPB7rxo/JJ09fVqYeOCX9DOic42hUDGxz7vvuELQ=; b=reUOJX/ZIu9ORZ7qUGs/wpkqJuB18FYBVAsrj874sO6J+lUyDECy5MTwySFORn2Jnx YWpNAlWpEhiE15h/I5MrNX0imMo+hFGxXClt98bG0Jlpxd2uZjpzHizjAk+aroSvA649 V60mcPCezrWohTm8pU3OvsWGZq7LJKVqinxPfiCtDJ3RVp6/KKlveLXntgGcc/o213Ul xaaluboVeUxMybzajVA1cHsR9DduFTCg/NlKVKYfrHhpIborWAWcrjWHLNgcdeOS3Du9 jERvEafGXEVy04kUwrJRI/GnA5oMHZ0wK1EdB2yZppyJi8kOq4sRlMmv9LDfN8pgbTFP mx/g== 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=yegkPB7rxo/JJ09fVqYeOCX9DOic42hUDGxz7vvuELQ=; b=s5l+AVbWJZuV0z7NASxTxQ7Pc4Uc9ZO3OXWr9D5qwVjwgGGPA+YW4ojmRct/s3pXjC uC3ly02/hOKSEZ3IAFothvGleOOBUtaDfZvYNmqg6OpzSt6vYqboCP4qppHZiBUOZWrg p+Vb8sv7LDOmdqMshqsg5bLiMF9mLwia3Hc+5cdeZghgM7WIk0h/WT042bMjBPN/W2Xe i8W+TzNP/sb1JlVIk6NLyW3GHv4RJ8Sm5K+twejLN0M/dgy+7j48HyNorkiUs/2gKydv caxRqVHkUVMWFRG5mQJjAjMf3LaQ8C7fwY1833lu6VOtI2lh/8/EGH82WdCTyDJM+jNf 8+4w== X-Gm-Message-State: APt69E3/juR7J3BqXlv5lSv1qFIgmI+19EhqPE4ItMEEGKydg7DfObQ3 MoBRkUlTB8CKMN5Im1dzEWRjxw== X-Google-Smtp-Source: ADUXVKJNQXHO0AVjyVmcqRiAgtgYAlKwJTMJrETzmh7FMP6Ua7Ix5m5rug31yyPSdAn9Go6mMJhoXw== X-Received: by 2002:ac8:7159:: with SMTP id h25-v6mr7299415qtp.206.1527784643056; Thu, 31 May 2018 09:37:23 -0700 (PDT) Received: from ip-172-31-0-168.ec2.internal (ec2-52-207-252-105.compute-1.amazonaws.com. [52.207.252.105]) by smtp.gmail.com with ESMTPSA id d20-v6sm25921365qtn.90.2018.05.31.09.37.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 09:37:22 -0700 (PDT) From: Martin Brandenburg To: hubcap@omnibond.com, linux-fsdevel@vger.kernel.org Cc: Martin Brandenburg , walt@omnibond.com Subject: [PATCH 2/3] orangefs: revamp block sizes Date: Thu, 31 May 2018 16:36:59 +0000 Message-Id: <20180531163700.783-2-martin@omnibond.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180531163700.783-1-martin@omnibond.com> References: <20180531163700.783-1-martin@omnibond.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now the superblock block size is PAGE_SIZE. The inode block size is PAGE_SIZE for directories and symlinks, but is the server-reported block size for regular files. The block size in the OrangeFS private inode is now deleted. Stat now reports PAGE_SIZE for directories and symlinks and the server-reported block size for regular files. The user-space visible change is that the block size for directores and symlinks and the superblock is now PAGE_SIZE rather than the size of the client-core shared memory buffers, which was typically four megabytes. Reported-by: Becky Ligon Signed-off-by: Martin Brandenburg Cc: hubcap@omnibond.com Cc: walt@omnibond.com --- fs/orangefs/inode.c | 6 ++---- fs/orangefs/orangefs-kernel.h | 1 - fs/orangefs/orangefs-utils.c | 12 ++++-------- fs/orangefs/super.c | 4 ++-- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 79c61da8b1bc..b583fbf90665 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -20,8 +20,8 @@ static int read_one_page(struct page *page) int max_block; ssize_t bytes_read = 0; struct inode *inode = page->mapping->host; - const __u32 blocksize = PAGE_SIZE; /* inode->i_blksize */ - const __u32 blockbits = PAGE_SHIFT; /* inode->i_blkbits */ + const __u32 blocksize = PAGE_SIZE; + const __u32 blockbits = PAGE_SHIFT; struct iov_iter to; struct bio_vec bv = {.bv_page = page, .bv_len = PAGE_SIZE}; @@ -262,7 +262,6 @@ int orangefs_getattr(const struct path *path, struct kstat *stat, /* override block size reported to stat */ orangefs_inode = ORANGEFS_I(inode); - stat->blksize = orangefs_inode->blksize; if (request_mask & STATX_SIZE) stat->result_mask = STATX_BASIC_STATS; @@ -325,7 +324,6 @@ static int orangefs_init_iops(struct inode *inode) case S_IFREG: inode->i_op = &orangefs_file_inode_operations; inode->i_fop = &orangefs_file_operations; - inode->i_blkbits = PAGE_SHIFT; break; case S_IFLNK: inode->i_op = &orangefs_symlink_inode_operations; diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h index c29bb0ebc6bb..004511617b6d 100644 --- a/fs/orangefs/orangefs-kernel.h +++ b/fs/orangefs/orangefs-kernel.h @@ -182,7 +182,6 @@ static inline void set_op_state_purged(struct orangefs_kernel_op_s *op) struct orangefs_inode_s { struct orangefs_object_kref refn; char link_target[ORANGEFS_NAME_MAX]; - __s64 blksize; /* * Reading/Writing Extended attributes need to acquire the appropriate * reader/writer semaphore on the orangefs_inode_s structure. diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c index 00fadaf0da8f..89729040c5b4 100644 --- a/fs/orangefs/orangefs-utils.c +++ b/fs/orangefs/orangefs-utils.c @@ -275,7 +275,7 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass, { struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); struct orangefs_kernel_op_s *new_op; - loff_t inode_size, rounded_up_size; + loff_t inode_size; int ret, type; gossip_debug(GOSSIP_UTILS_DEBUG, "%s: called on inode %pU\n", __func__, @@ -330,22 +330,19 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass, if (request_mask & STATX_SIZE || new) { inode_size = (loff_t)new_op-> downcall.resp.getattr.attributes.size; - rounded_up_size = - (inode_size + (4096 - (inode_size % 4096))); inode->i_size = inode_size; - orangefs_inode->blksize = - new_op->downcall.resp.getattr.attributes.blksize; + inode->i_blkbits = ffs(new_op->downcall.resp.getattr. + attributes.blksize); spin_lock(&inode->i_lock); inode->i_bytes = inode_size; inode->i_blocks = - (unsigned long)(rounded_up_size / 512); + (inode_size + 512 - inode_size % 512)/512; spin_unlock(&inode->i_lock); } break; case S_IFDIR: if (request_mask & STATX_SIZE || new) { inode->i_size = PAGE_SIZE; - orangefs_inode->blksize = i_blocksize(inode); spin_lock(&inode->i_lock); inode_set_bytes(inode, inode->i_size); spin_unlock(&inode->i_lock); @@ -356,7 +353,6 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass, if (new) { inode->i_size = (loff_t)strlen(new_op-> downcall.resp.getattr.link_target); - orangefs_inode->blksize = i_blocksize(inode); ret = strscpy(orangefs_inode->link_target, new_op->downcall.resp.getattr.link_target, ORANGEFS_NAME_MAX); diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index 3ae5fdba0225..b802486aab0a 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -423,8 +423,8 @@ static int orangefs_fill_sb(struct super_block *sb, sb->s_op = &orangefs_s_ops; sb->s_d_op = &orangefs_dentry_operations; - sb->s_blocksize = orangefs_bufmap_size_query(); - sb->s_blocksize_bits = orangefs_bufmap_shift_query(); + sb->s_blocksize = PAGE_SIZE; + sb->s_blocksize_bits = PAGE_SHIFT; sb->s_maxbytes = MAX_LFS_FILESIZE; root_object.khandle = ORANGEFS_SB(sb)->root_khandle;