@@ -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;
}
@@ -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;
@@ -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);
}
@@ -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;
}
@@ -32,6 +32,7 @@
#include <linux/workqueue.h>
#include <linux/percpu-rwsem.h>
#include <linux/delayed_call.h>
+#include <linux/hash.h>
#include <asm/byteorder.h>
#include <uapi/linux/fs.h>
@@ -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;
}
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 <shaun.tancheff@seagate.com> --- 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(-)