mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
cephfs: add read affinity mount option
This commit makes use of crush location labels from node labels to supply `crush_location` and `read_from_replica=localize` options during mount. Using these options, cephfs will be able to redirect reads to the closest OSD, improving performance. Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
@ -766,11 +766,12 @@ func (ns *NodeServer) setMountOptions(
|
||||
csiConfigFile string,
|
||||
) error {
|
||||
var (
|
||||
configuredMountOptions string
|
||||
kernelMountOptions string
|
||||
fuseMountOptions string
|
||||
mountOptions []string
|
||||
err error
|
||||
configuredMountOptions string
|
||||
readAffinityMountOptions string
|
||||
kernelMountOptions string
|
||||
fuseMountOptions string
|
||||
mountOptions []string
|
||||
err error
|
||||
)
|
||||
if m := volCap.GetMount(); m != nil {
|
||||
mountOptions = m.GetMountFlags()
|
||||
@ -781,6 +782,14 @@ func (ns *NodeServer) setMountOptions(
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// read affinity mount options
|
||||
readAffinityMountOptions, err = util.GetReadAffinityMapOptions(
|
||||
csiConfigFile, volOptions.ClusterID, ns.CLIReadAffinityOptions, ns.NodeLabels,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
switch mnt.(type) {
|
||||
@ -799,6 +808,7 @@ func (ns *NodeServer) setMountOptions(
|
||||
configuredMountOptions = kernelMountOptions
|
||||
}
|
||||
volOptions.KernelMountOptions = util.MountOptionsAdd(volOptions.KernelMountOptions, configuredMountOptions)
|
||||
volOptions.KernelMountOptions = util.MountOptionsAdd(volOptions.KernelMountOptions, readAffinityMountOptions)
|
||||
volOptions.KernelMountOptions = util.MountOptionsAdd(volOptions.KernelMountOptions, mountOptions...)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user