I decided to drop the "cfs_" prefix since there are other "sg_" calls in the code which do not use any "cfs_" wrappers. So to be consistent with those calls, I think it's best to leave them with the "sg_" prefix.
Prakash Surya (Inactive)
added a comment - I decided to drop the "cfs_" prefix since there are other "sg_" calls in the code which do not use any "cfs_" wrappers. So to be consistent with those calls, I think it's best to leave them with the "sg_" prefix.
Or maybe cfs_ prefix for this functions.
lnet/klnds/o2iblnd/o2iblnd_cb.c already use initialized sg, and set_page is faster then set_buf, because it skip addr to page conversion.
Alexander Boyko
added a comment - I think it`s better to add something like this to libcfs headers.
#ifndef HAVE_SCATTERLIST_INITTABLE
#define sg_init_table(sg, nents) memset(sg, 0, sizeof(*(sg))*(nents))
#endif
#ifndef HAVE_SCATTERLIST_SETPAGE
sg_set_page(sg, p, len, off) sg_set_buf(sg, page_address(p) + (off & ~CFS_PAGE_MASK), len)
#endif
Or maybe cfs_ prefix for this functions.
lnet/klnds/o2iblnd/o2iblnd_cb.c already use initialized sg, and set_page is faster then set_buf, because it skip addr to page conversion.
Those locations all make a direct call to sg_set_page which might need to change to sg_init_one.
Prakash Surya (Inactive)
added a comment - Some other places which may need similar fixes:
lnet/klnds/o2iblnd/o2iblnd_cb.c:730
lnet/klnds/o2iblnd/o2iblnd_cb.c:773
lustre/obdclass/capa.c:266
lustre/obdclass/capa.c:308
lustre/obdclass/capa.c:311
lustre/obdclass/capa.c:261
lustre/obdclass/capa.c:364
Those locations all make a direct call to sg_set_page which might need to change to sg_init_one.
Alexander, sure I'll merge your fix into mine. I'll update this ticket when I push the new version and add you to the review list. I should be able to do that later today.
Prakash Surya (Inactive)
added a comment - Alexander, sure I'll merge your fix into mine. I'll update this ticket when I push the new version and add you to the review list. I should be able to do that later today.
Sure, I'm open to merging the two or landing one and reworking the other. It's probably a good idea to scan the rest of the code for areas which need similar fixes as well.
Prakash Surya (Inactive)
added a comment - Sure, I'm open to merging the two or landing one and reworking the other. It's probably a good idea to scan the rest of the code for areas which need similar fixes as well.
OK, looking more closely, this has the same cause as ORI-722, but affects different code.
Alexander and Prakash, could you please get together to make a single common patch that fixes these issues, or at least have a single autoconf check. I prefer the approach in http://review.whamcloud.com/3423 that has a wrapper that can be used in all the code, instead of #ifdefs inline in the code as in http://review.whamcloud.com/3552.
Andreas Dilger
added a comment - OK, looking more closely, this has the same cause as ORI-722 , but affects different code.
Alexander and Prakash, could you please get together to make a single common patch that fixes these issues, or at least have a single autoconf check. I prefer the approach in http://review.whamcloud.com/3423 that has a wrapper that can be used in all the code, instead of #ifdefs inline in the code as in http://review.whamcloud.com/3552 .
Xyratex-bug-id: MRP-611