Skip to content

Commit f003368

Browse files
committed
Merge tag 'for-linus-5.17-ofs-1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux
Pull orangefs fixes from Mike Marshall: "Two fixes: - Fix the size of a memory allocation in orangefs_bufmap_alloc() (Christophe JAILLET) - Use default_groups in kobj_type (Greg KH)" * tag 'for-linus-5.17-ofs-1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux: orangefs: Fix the size of a memory allocation in orangefs_bufmap_alloc() orangefs: use default_groups in kobj_type
2 parents 0c947b8 + 40a7487 commit f003368

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

fs/orangefs/orangefs-bufmap.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ orangefs_bufmap_free(struct orangefs_bufmap *bufmap)
176176
{
177177
kfree(bufmap->page_array);
178178
kfree(bufmap->desc_array);
179-
kfree(bufmap->buffer_index_array);
179+
bitmap_free(bufmap->buffer_index_array);
180180
kfree(bufmap);
181181
}
182182

@@ -226,8 +226,7 @@ orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc)
226226
bufmap->desc_size = user_desc->size;
227227
bufmap->desc_shift = ilog2(bufmap->desc_size);
228228

229-
bufmap->buffer_index_array =
230-
kzalloc(DIV_ROUND_UP(bufmap->desc_count, BITS_PER_LONG), GFP_KERNEL);
229+
bufmap->buffer_index_array = bitmap_zalloc(bufmap->desc_count, GFP_KERNEL);
231230
if (!bufmap->buffer_index_array)
232231
goto out_free_bufmap;
233232

@@ -250,7 +249,7 @@ orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc)
250249
out_free_desc_array:
251250
kfree(bufmap->desc_array);
252251
out_free_index_array:
253-
kfree(bufmap->buffer_index_array);
252+
bitmap_free(bufmap->buffer_index_array);
254253
out_free_bufmap:
255254
kfree(bufmap);
256255
out:

fs/orangefs/orangefs-sysfs.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -894,10 +894,11 @@ static struct attribute *orangefs_default_attrs[] = {
894894
&perf_time_interval_secs_attribute.attr,
895895
NULL,
896896
};
897+
ATTRIBUTE_GROUPS(orangefs_default);
897898

898899
static struct kobj_type orangefs_ktype = {
899900
.sysfs_ops = &orangefs_sysfs_ops,
900-
.default_attrs = orangefs_default_attrs,
901+
.default_groups = orangefs_default_groups,
901902
};
902903

903904
static struct orangefs_attribute acache_hard_limit_attribute =
@@ -931,10 +932,11 @@ static struct attribute *acache_orangefs_default_attrs[] = {
931932
&acache_timeout_msecs_attribute.attr,
932933
NULL,
933934
};
935+
ATTRIBUTE_GROUPS(acache_orangefs_default);
934936

935937
static struct kobj_type acache_orangefs_ktype = {
936938
.sysfs_ops = &orangefs_sysfs_ops,
937-
.default_attrs = acache_orangefs_default_attrs,
939+
.default_groups = acache_orangefs_default_groups,
938940
};
939941

940942
static struct orangefs_attribute capcache_hard_limit_attribute =
@@ -968,10 +970,11 @@ static struct attribute *capcache_orangefs_default_attrs[] = {
968970
&capcache_timeout_secs_attribute.attr,
969971
NULL,
970972
};
973+
ATTRIBUTE_GROUPS(capcache_orangefs_default);
971974

972975
static struct kobj_type capcache_orangefs_ktype = {
973976
.sysfs_ops = &orangefs_sysfs_ops,
974-
.default_attrs = capcache_orangefs_default_attrs,
977+
.default_groups = capcache_orangefs_default_groups,
975978
};
976979

977980
static struct orangefs_attribute ccache_hard_limit_attribute =
@@ -1005,10 +1008,11 @@ static struct attribute *ccache_orangefs_default_attrs[] = {
10051008
&ccache_timeout_secs_attribute.attr,
10061009
NULL,
10071010
};
1011+
ATTRIBUTE_GROUPS(ccache_orangefs_default);
10081012

10091013
static struct kobj_type ccache_orangefs_ktype = {
10101014
.sysfs_ops = &orangefs_sysfs_ops,
1011-
.default_attrs = ccache_orangefs_default_attrs,
1015+
.default_groups = ccache_orangefs_default_groups,
10121016
};
10131017

10141018
static struct orangefs_attribute ncache_hard_limit_attribute =
@@ -1042,10 +1046,11 @@ static struct attribute *ncache_orangefs_default_attrs[] = {
10421046
&ncache_timeout_msecs_attribute.attr,
10431047
NULL,
10441048
};
1049+
ATTRIBUTE_GROUPS(ncache_orangefs_default);
10451050

10461051
static struct kobj_type ncache_orangefs_ktype = {
10471052
.sysfs_ops = &orangefs_sysfs_ops,
1048-
.default_attrs = ncache_orangefs_default_attrs,
1053+
.default_groups = ncache_orangefs_default_groups,
10491054
};
10501055

10511056
static struct orangefs_attribute pc_acache_attribute =
@@ -1072,10 +1077,11 @@ static struct attribute *pc_orangefs_default_attrs[] = {
10721077
&pc_ncache_attribute.attr,
10731078
NULL,
10741079
};
1080+
ATTRIBUTE_GROUPS(pc_orangefs_default);
10751081

10761082
static struct kobj_type pc_orangefs_ktype = {
10771083
.sysfs_ops = &orangefs_sysfs_ops,
1078-
.default_attrs = pc_orangefs_default_attrs,
1084+
.default_groups = pc_orangefs_default_groups,
10791085
};
10801086

10811087
static struct orangefs_attribute stats_reads_attribute =
@@ -1095,10 +1101,11 @@ static struct attribute *stats_orangefs_default_attrs[] = {
10951101
&stats_writes_attribute.attr,
10961102
NULL,
10971103
};
1104+
ATTRIBUTE_GROUPS(stats_orangefs_default);
10981105

10991106
static struct kobj_type stats_orangefs_ktype = {
11001107
.sysfs_ops = &orangefs_sysfs_ops,
1101-
.default_attrs = stats_orangefs_default_attrs,
1108+
.default_groups = stats_orangefs_default_groups,
11021109
};
11031110

11041111
static struct kobject *orangefs_obj;

0 commit comments

Comments
 (0)