}
LUSTRE_RW_ATTR(pcc_mode);
+static ssize_t pcc_async_affinity_show(struct kobject *kobj,
+ struct attribute *attr, char *buffer)
+{
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
+ struct pcc_super *super = &sbi->ll_pcc_super;
+
+ return sprintf(buffer, "%d\n", super->pccs_async_affinity);
+}
+
+static ssize_t pcc_async_affinity_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
+ struct pcc_super *super = &sbi->ll_pcc_super;
+ bool val;
+ int rc;
+
+ rc = kstrtobool(buffer, &val);
+ if (rc)
+ return rc;
+
+ super->pccs_async_affinity = val;
+
+ return count;
+}
+LUSTRE_RW_ATTR(pcc_async_affinity);
+
static ssize_t checksums_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
&lustre_attr_inode_cache.attr,
&lustre_attr_pcc_async_threshold.attr,
&lustre_attr_pcc_mode.attr,
+ &lustre_attr_pcc_async_affinity.attr,
&lustre_attr_opencache_threshold_count.attr,
&lustre_attr_opencache_threshold_ms.attr,
&lustre_attr_opencache_max_ms.attr,
static int pcc_readonly_attach_async(struct file *file,
struct inode *inode, __u32 roid)
{
- int node = cfs_cpt_spread_node(cfs_cpt_tab, CFS_CPT_ANY);
struct pcc_attach_context *pccx = NULL;
struct task_struct *task;
int rc;
if (!pccx)
GOTO(out, rc = -ENOMEM);
- task = kthread_create_on_node(pcc_readonly_attach_thread, pccx, node,
+ if (ll_i2pccs(inode)->pccs_async_affinity) {
+ /* Create a attach kthread on the current node. */
+ task = kthread_create(pcc_readonly_attach_thread, pccx,
"ll_pcc_%u", current->pid);
+ } else {
+ int node = cfs_cpt_spread_node(cfs_cpt_tab, CFS_CPT_ANY);
+
+ task = kthread_create_on_node(pcc_readonly_attach_thread, pccx,
+ node, "ll_pcc_%u", current->pid);
+ }
+
if (IS_ERR(task)) {
rc = PTR_ERR(task);
CERROR("%s: can't start ll_pcc thread for "DFID", rc = %d\n",