RFC patch as of now, appreciate your comments. This patch set has
been tested.
Function call chain __btrfs_map_block()->find_live_mirror() uses
thread pid to determine the %mirror_num when the mirror_num=0.
The pid based mirror_num extrapolation has following disadvantages
. A large single-process read IO will read only from one disk.
. In a worst scenario all processes read accessing the FS could have
either odd or even pid, the read IO gets skewed.
. There is no deterministic way of knowing/controlling which copy will
be used for reading.
. May see performance variations for a given set of multi process
workload ran at different times.
So we need other types of readmirror policies.
This patch introduces a framework so that we can add more policies, and
converts the existing %pid into as a configurable parameter using the
property. And also provides a transient readmirror mount option, so that
this property can be applied for the read io during mount and for
readonly FS.
For example:
btrfs property set <mnt> readmirror pid
btrfs property set <mnt> readmirror ""
btrfs property set <mnt> readmirror devid<n>
mount -o readmirror=pid <mnt>
mount -o readmirror=devid<n> <mnt>
Please note:
The property storage is an extented attributes of root inode
(BTRFS_FS_TREE_OBJECTID), the other choice is a new ondisk KEY,
which is open for comments.
This patch uses the unused btrfs_device::type, and does not use the
bitwise ops because as type is u64 and bitwise ops need u32, so we
need 32bits of the btrfs_device::type. Which is a kind of messy.
Its open for suggestion for any better way.
Anand Jain (5):
btrfs: add inode pointer to prop_handler::validate()
btrfs: add readmirror pid property
btrfs: add readmirror devid property
btrfs: add readmirror pid mount option
btrfs: add readmirror devid mount option
fs/btrfs/props.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++---
fs/btrfs/super.c | 29 ++++++++++++++++
fs/btrfs/volumes.c | 29 +++++++++++++++-
fs/btrfs/volumes.h | 11 ++++++
4 files changed, 163 insertions(+), 5 deletions(-)
Anand Jain (2):
btrfs-progs: add helper to create xattr name
btrfs-progs: add readmirror policy
props.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 68 insertions(+), 7 deletions(-)
--
1.8.3.1