From patchwork Mon Apr 4 05:06:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaun Tancheff X-Patchwork-Id: 8737461 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D97C2C0554 for ; Mon, 4 Apr 2016 05:07:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E70CB20219 for ; Mon, 4 Apr 2016 05:07:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F21D220204 for ; Mon, 4 Apr 2016 05:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752717AbcDDFHH (ORCPT ); Mon, 4 Apr 2016 01:07:07 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35472 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752542AbcDDFHE (ORCPT ); Mon, 4 Apr 2016 01:07:04 -0400 Received: by mail-pf0-f193.google.com with SMTP id r187so10557397pfr.2; Sun, 03 Apr 2016 22:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=gf2qssnZD8+FG6EbvulHlNoKPtgcOMWP97Vev5XhlyY=; b=wB8uC3PYK67NA6R4E4bKl+2H5HmJTlM4oTspEZ/ZmMhdscALtXKmMxke0zq+eiMPtF lBNfR57fn2G8FBG9IXbon6nCRBJv44CYGLxEKBqwXZLHg1OMHcWa3c9o8D8M3l/QQI1Q zF9Ysq2imOBR4ZdjP7efO5LfI7IOwcKhLeCcc4/PL4lsnHfFFOYQXeGIt+xcEUMiWCZq VtNNGMf3VAXJOV64ntqkvNcec/g3e8myiLVwPnxMWBkl3IvgvCJKVyXH9hO15HrxUDEd 4Ax7fM4tI/kmI/oBxg9ezmwEwNW0/Pg6cu3wKv4BmeWpqSwmhNWeELG+VsRxzw8Ab5uK P23A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=gf2qssnZD8+FG6EbvulHlNoKPtgcOMWP97Vev5XhlyY=; b=jEAsCfeMNq8U1AvmCVoBWE5lZzFap32fP8W7piOO0XFdlk15SpHiHip4V/yD6na5Ct DVHpal39PEUGdpstvaTwUSOTUJ7reHarmp6KfLoENEUORM0E9gcHESRLm2/QU5ogwFI+ d4gAsCS4Vh0uSR1ep1UeCscXPqms0Zr6MzQawnBJ+sUF618ZxGHOYdwdKOhkSOosjZ3Y zz9gQD7qJmQXG6TqevMnOe5QcwJ+AqL1rcQY7R1Sj5xiPHi6lbSjC7IB7UD6CdaufxcN lUhFuaNJuWXzvMOdScg/rAcBseXGRqJx43a0lyNa2zkPVsxoosIfqJ4u1l954um6Tpht EQCA== X-Gm-Message-State: AD7BkJKqU6UyZFwYSe5L6m4W9ySc5Fs5bkRZd/FOy0tchl/9zyAHC/7aAIvnn9xT+a3K4g== X-Received: by 10.98.18.71 with SMTP id a68mr17909757pfj.41.1459746423768; Sun, 03 Apr 2016 22:07:03 -0700 (PDT) Received: from localhost.localdomain ([103.47.135.1]) by smtp.gmail.com with ESMTPSA id k65sm35804188pfb.30.2016.04.03.22.07.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 03 Apr 2016 22:07:03 -0700 (PDT) From: Shaun Tancheff To: linux-ide@vger.kernel.org, dm-devel@redhat.com, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Jens Axboe , Shaun Tancheff , Shaun Tancheff Subject: [PATCH 11/12] Stream Id: Use PID to seed Stream Id construction. Date: Mon, 4 Apr 2016 12:06:15 +0700 Message-Id: <1459746376-27983-12-git-send-email-shaun@tancheff.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459746376-27983-1-git-send-email-shaun@tancheff.com> References: <1459746376-27983-1-git-send-email-shaun@tancheff.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Depends on: https://lkml.kernel.org/r/1457107853-8689-1-git-send-email-axboe@fb.com Use file open PID and inode's i_no to differentiate seed generation streamid when fadvise is not supplied. Effectivly attempting simulate the effect that stream id may have on certain predictable workloads. Signed-off-by: Shaun Tancheff --- drivers/md/dm-zoned.c | 12 +++++++++++- fs/ext4/file.c | 1 + fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_file.c | 1 + include/linux/fs.h | 10 ++++++++-- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-zoned.c b/drivers/md/dm-zoned.c index 6cab33e..90da803 100644 --- a/drivers/md/dm-zoned.c +++ b/drivers/md/dm-zoned.c @@ -121,8 +121,18 @@ static inline u32 bio_stream(struct bio *bio) * use this heuristic to try to skip unnecessary co-mingling of data. */ - if (bio->bi_rw & REQ_META) + if (bio->bi_rw & REQ_META) { stream_id = 0xff; + } else { + unsigned int id = bio_get_streamid(bio); + + /* high 8 bits is hash of PID, low 8 bits is hash of inode# */ + stream_id = id >> 8; + if (stream_id == 0) + stream_id++; + if (stream_id == 0xff) + stream_id--; + } return stream_id; } diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 4cd318f..1c5102c 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -340,6 +340,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp) char buf[64], *cp; int ret; + inode->pid = get_current()->pid; if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) && !(sb->s_flags & MS_RDONLY))) { sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED; diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 9a35e61..8f78de4 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -382,7 +382,7 @@ xfs_submit_ioend_bio( atomic_inc(&ioend->io_remaining); bio->bi_private = ioend; bio->bi_end_io = xfs_end_bio; - bio_set_streamid(bio, ioend->io_inode->i_streamid); + bio_set_streamid(bio, inode_streamid(ioend->io_inode)); submit_bio(wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE, bio); } diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 52883ac..c38ea85 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1058,6 +1058,7 @@ xfs_file_open( return -EFBIG; if (XFS_FORCED_SHUTDOWN(XFS_M(inode->i_sb))) return -EIO; + inode->pid = get_current()->pid; return 0; } diff --git a/include/linux/fs.h b/include/linux/fs.h index 10599d2..5d45e66 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -678,15 +679,20 @@ struct inode { __u32 i_fsnotify_mask; /* all events this inode cares about */ struct hlist_head i_fsnotify_marks; #endif + pid_t pid; /* use PID for fallback streamid */ void *i_private; /* fs or device private pointer */ }; static inline unsigned int inode_streamid(struct inode *inode) { - if (inode) - return inode->i_streamid; + if (inode) { + if (inode->i_streamid) + return inode->i_streamid; + return ((hash_32(inode->pid, 8) << 8) + |hash_32(inode->i_ino, 8)); + } return 0; }