Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2015-10-28 20:44:46 -07:00
14 changed files with 520 additions and 455 deletions
+8 -5
View File
@@ -410,16 +410,19 @@ fcst_extraclean:
scst-dist-gzip:
name=scst && \
mkdir $${name}-$(VERSION) && \
{ if [ -h qla2x00t ] || { mount | grep "on $$PWD/qla2x00t type"; }; \
then \
{ \
if [ -e qla2x00t_git ]; then \
scripts/list-source-files | grep -v ^qla2x00t/; \
find qla2x00t/ -type f; \
( dir="$$PWD" && cd qla2x00t_git && \
"$$dir/scripts/list-source-files" ) | \
sed 's,^,qla2x00t_git/,'; \
else \
scripts/list-source-files; \
fi | \
grep -E '^doc/|^fcst/|^iscsi-scst/|^Makefile|^qla2x00t/|^scst.spec|^scst/|^scst_local/|^srpt/'|\
grep -E '^doc/|^fcst/|^iscsi-scst/|^Makefile|^qla2x00t(|_git)/|^scst.spec|^scst/|^scst_local/|^srpt/'|\
tar -T- -cf- | \
tar -C $${name}-$(VERSION) -xf-; } && \
tar -C $${name}-$(VERSION) -xf-; \
} && \
rm -f $${name}-$(VERSION).tar.bz2 && \
tar -cjf $${name}-$(VERSION).tar.bz2 $${name}-$(VERSION) && \
rm -rf $${name}-$(VERSION)
+10 -2
View File
@@ -1,4 +1,12 @@
iscsi-scst-y := iscsi.o nthread.o config.o digest.o \
conn.o session.o target.o event.o param.o iscsit_transport.o
iscsi-scst-y += config.o
iscsi-scst-y += conn.o
iscsi-scst-y += digest.o
iscsi-scst-y += event.o
iscsi-scst-y += iscsi.o
iscsi-scst-y += iscsit_transport.o
iscsi-scst-y += nthread.o
iscsi-scst-y += param.o
iscsi-scst-y += session.o
iscsi-scst-y += target.o
obj-$(CONFIG_SCST_ISCSI) += iscsi-scst.o isert-scst/
@@ -126,7 +126,12 @@ static struct iscsi_cmnd *isert_alloc_scsi_pdu(struct iscsi_conn *iscsi_conn,
struct isert_connection *isert_conn = (struct isert_connection *)iscsi_conn;
struct isert_cmnd *isert_pdu;
again:
spin_lock(&isert_conn->tx_lock);
if (list_empty(&isert_conn->tx_free_list)) {
spin_unlock(&isert_conn->tx_lock);
goto again;
}
isert_pdu = list_first_entry(&isert_conn->tx_free_list,
struct isert_cmnd, pool_node);
list_move(&isert_pdu->pool_node, &isert_conn->tx_busy_list);
+4 -4
View File
@@ -3,19 +3,19 @@
ABT_DETAILS="x86_64"
ABT_JOBS=5
ABT_KERNELS=" \
4.2.3 \
4.1.10-nc \
4.2.5 \
4.1.12-nc \
4.0.9-nc \
3.19.7-nc \
3.18.19-nc \
3.17.8-nc \
3.16.7-nc \
3.15.10-nc \
3.14.54-nc \
3.14.56-nc \
3.13.11-nc \
3.12.44-nc \
3.11.10-nc \
3.10.90-nc \
3.10.92-nc \
3.9.11-nc \
3.8.13-nc \
3.7.10-nc \
+8 -2
View File
@@ -1,12 +1,18 @@
#!/bin/bash
inode() {
ls -id "$1" | { read a b; echo "$a"; }
}
list_source_files() {
local d r
d="$(cd "$1" && echo "$PWD")"
r="$d"
while [ "$r" != "/" -a ! -e "$r/.svn" -a ! -e "$r/.git" -a ! -e "$r/.hg" ]; do
r="$(dirname "$r")"
inode_root="$(inode /)"
while [ $(inode "$r") != "${inode_root}" -a \
! -e "$r/.svn" -a ! -e "$r/.git" -a ! -e "$r/.hg" ]; do
r="$r/.."
done
if [ -e "$r/.svn" ]; then
+15 -2
View File
@@ -114,9 +114,15 @@ export KVER=%{kversion} PREFIX=%{_prefix}
%{?kdir:%{expand:%%(export KDIR=%{kdir})}}
export BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y
make 2release
for d in scst fcst iscsi-scst qla2x00t/qla2x00-target scst_local srpt; do
for d in scst fcst iscsi-scst scst_local srpt; do
%{make} -C $d
done
for d in qla2x00t_git/qla2x00-target qla2x00t/qla2x00-target; do
if [ -e $d ]; then
%{make} -C $d
break
fi
done
%install
export KVER=%{kversion} PREFIX=%{_prefix} MANDIR=%{_mandir}
@@ -125,9 +131,15 @@ export BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y
for d in scst; do
DESTDIR=%{buildroot} %{make} -C $d install
done
for d in fcst iscsi-scst qla2x00t/qla2x00-target scst_local srpt; do
for d in fcst iscsi-scst scst_local srpt; do
DESTDIR=%{buildroot} INSTALL_MOD_PATH=%{buildroot} %{make} -C $d install
done
for d in qla2x00t_git/qla2x00-target qla2x00t/qla2x00-target; do
if [ -e $d ]; then
DESTDIR=%{buildroot} INSTALL_MOD_PATH=%{buildroot} %{make} -C $d install
break
fi
done
rm -f %{buildroot}/lib/modules/%{kversion}/[Mm]odule*
%clean
@@ -180,6 +192,7 @@ rm -rf /usr/local/include/scst
%defattr(-,root,root)
%dir /usr/include/scst
/usr/include/scst/Module.symvers
/usr/include/scst/backport.h
/usr/include/scst/scst.h
/usr/include/scst/scst_const.h
/usr/include/scst/scst_debug.h
+3 -3
View File
@@ -1601,7 +1601,7 @@ standard INQUIRY:
[SPI: Clocking=0x0 QAS=0 IUS=0]
length=66 (0x42) Peripheral device type: disk
Vendor identification: SCST_FIO
Product identification: disk01
Product identification: disk01
Product revision level: 300
Unit serial number: 27cddc71
@@ -1665,13 +1665,13 @@ Notes:
'prio_callout "/sbin/mpath_prio_alua /dev/%n"' instead of 'prio alua'.
# multipath -ll
23237636464633731 dm-3 SCST_FIO,disk01
23237636464633731 dm-3 SCST_FIO,disk01
size=1.0G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 10:0:0:0 sdd 8:48 active ready running
`-+- policy='service-time 0' prio=130 status=enabled
`- 11:0:0:0 sde 8:64 active ready running
23133326137346538 dm-4 SCST_FIO,disk02
23133326137346538 dm-4 SCST_FIO,disk02
size=1.0G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=130 status=active
| `- 10:0:0:2 sdn 8:208 active ready running
+3 -3
View File
@@ -1449,7 +1449,7 @@ standard INQUIRY:
[SPI: Clocking=0x0 QAS=0 IUS=0]
length=66 (0x42) Peripheral device type: disk
Vendor identification: SCST_FIO
Product identification: disk01
Product identification: disk01
Product revision level: 300
Unit serial number: 27cddc71
@@ -1513,13 +1513,13 @@ Notes:
'prio_callout "/sbin/mpath_prio_alua /dev/%n"' instead of 'prio alua'.
# multipath -ll
23237636464633731 dm-3 SCST_FIO,disk01
23237636464633731 dm-3 SCST_FIO,disk01
size=1.0G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 10:0:0:0 sdd 8:48 active ready running
`-+- policy='service-time 0' prio=130 status=enabled
`- 11:0:0:0 sde 8:64 active ready running
23133326137346538 dm-4 SCST_FIO,disk02
23133326137346538 dm-4 SCST_FIO,disk02
size=1.0G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=130 status=active
| `- 10:0:0:2 sdn 8:208 active ready running
+434
View File
@@ -22,6 +22,171 @@
#include <linux/writeback.h> /* sync_page_range() */
/* <asm-generic/barrier.h> */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
#define smp_mb__after_atomic_inc smp_mb__after_atomic
#define smp_mb__after_clear_bit smp_mb__after_atomic
#define smp_mb__before_atomic_dec smp_mb__before_atomic
#define smp_mb__after_atomic_dec smp_mb__after_atomic
#endif
/* <asm-generic/fcntl.h> */
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 32)
#ifndef O_DSYNC
#define O_DSYNC O_SYNC
#endif
#endif
/* <linux/blkdev.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
{
return q->max_hw_sectors;
}
#endif
/* <linux/compiler.h> */
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20)
#ifndef __printf
#define __printf(a, b) __attribute__((format(printf,a,b)))
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
#ifndef __aligned
#define __aligned(x) __attribute__((aligned(x)))
#endif
#ifndef __packed
#define __packed __attribute__((packed))
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
/*
* See also patch "Move ACCESS_ONCE() to <linux/compiler.h>" (commit ID
* 9c3cdc1f83a6e07092392ff4aba6466517dbd1d0).
*/
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
#endif
/* <linux/cpumask.h> */
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) && !defined(BACKPORT_LINUX_CPUMASK_H)
#define nr_cpu_ids NR_CPUS
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28) && defined(__LINUX_CPUMASK_H)
/*
* See also patch "cpumask: introduce new API, without changing anything"
* (commit ID 2d3854a37e8b).
*/
typedef cpumask_t cpumask_var_t[1];
#define cpumask_bits(maskp) ((maskp)->bits)
#ifdef CONFIG_CPUMASK_OFFSTACK
/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
* not all bits may be allocated. */
#define nr_cpumask_bits nr_cpu_ids
#else
#define nr_cpumask_bits NR_CPUS
#endif
#ifdef CONFIG_CPUMASK_OFFSTACK
bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
void free_cpumask_var(cpumask_var_t mask);
#else
static inline void free_cpumask_var(cpumask_var_t mask)
{
}
static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
{
return true;
}
#endif
/* verify cpu argument to cpumask_* operators */
static inline unsigned int cpumask_check(unsigned int cpu)
{
#ifdef CONFIG_DEBUG_PER_CPU_MAPS
WARN_ON_ONCE(cpu >= nr_cpumask_bits);
#endif /* CONFIG_DEBUG_PER_CPU_MAPS */
return cpu;
}
/**
* cpumask_next - get the next cpu in a cpumask
* @n: the cpu prior to the place to search (ie. return will be > @n)
* @srcp: the cpumask pointer
*
* Returns >= nr_cpu_ids if no further cpus set.
*/
static inline unsigned int cpumask_next(int n, const cpumask_t *srcp)
{
/* -1 is a legal arg here. */
if (n != -1)
cpumask_check(n);
return find_next_bit(cpumask_bits(srcp), nr_cpumask_bits, n+1);
}
/**
* for_each_cpu - iterate over every cpu in a mask
* @cpu: the (optionally unsigned) integer iterator
* @mask: the cpumask pointer
*
* After the loop, cpu is >= nr_cpu_ids.
*/
#define for_each_cpu(cpu, mask) \
for ((cpu) = -1; \
(cpu) = cpumask_next((cpu), (mask)), \
(cpu) < nr_cpu_ids;)
/**
* cpumask_set_cpu - set a cpu in a cpumask
* @cpu: cpu number (< nr_cpu_ids)
* @dstp: the cpumask pointer
*/
static inline void cpumask_set_cpu(unsigned int cpu, cpumask_t *dstp)
{
set_bit(cpu, cpumask_bits(dstp));
}
/**
* cpumask_copy - *dstp = *srcp
* @dstp: the result
* @srcp: the input cpumask
*/
static inline void cpumask_copy(cpumask_t *dstp,
const cpumask_t *srcp)
{
bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), nr_cpumask_bits);
}
/**
* cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask
* @dstp: the cpumask pointer
*/
static inline void cpumask_setall(cpumask_t *dstp)
{
bitmap_fill(cpumask_bits(dstp), nr_cpumask_bits);
}
/**
* cpumask_equal - *src1p == *src2p
* @src1p: the first input
* @src2p: the second input
*/
static inline bool cpumask_equal(const cpumask_t *src1p,
const cpumask_t *src2p)
{
return bitmap_equal(cpumask_bits(src1p), cpumask_bits(src2p),
nr_cpumask_bits);
}
#endif
/* <linux/fs.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) && \
@@ -52,4 +217,273 @@ static inline int vfs_fsync_backport(struct file *file, int datasync)
#define vfs_fsync vfs_fsync_backport
#endif
/* <linux/kernel.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
#ifndef RHEL_RELEASE_CODE
typedef _Bool bool;
#endif
#define true 1
#define false 0
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
#ifndef swap
#define swap(a, b) \
do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6 || \
RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 1)
extern int hex_to_bin(char ch);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
/*
* See also "lib: hex2bin converts ascii hexadecimal string to binary" (commit
* dc88e46029486ed475c71fe1bb696d39511ac8fe).
*/
static inline void hex2bin(u8 *dst, const char *src, size_t count)
{
while (count--) {
*dst = hex_to_bin(*src++) << 4;
*dst += hex_to_bin(*src++);
dst++;
}
}
#endif
/* <linux/list.h> */
#ifndef __list_for_each
/* ToDo: cleanup when both are the same for all relevant kernels */
#define __list_for_each list_for_each
#endif
/*
* Returns true if entry is in its list. Entry must be deleted from the
* list by using list_del_init()!
*/
static inline bool list_entry_in_list(const struct list_head *entry)
{
return !list_empty(entry);
}
/* <linux/lockdep.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32)
#define lockdep_assert_held(l) do { (void)(l); } while (0)
#endif
/* <linux/preempt.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
/*
* See also patch "sched: Fix softirq time accounting" (commit ID
* 75e1056f5c57050415b64cb761a3acc35d91f013).
*/
#ifndef in_serving_softirq
#define in_serving_softirq() in_softirq()
#endif
#endif
/* <linux/printk.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
#ifndef pr_err
#define pr_err(fmt, ...) printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
/*
* See also patch "kernel.h: add pr_warn for symmetry to dev_warn,
* netdev_warn" (commit fc62f2f19edf46c9bdbd1a54725b56b18c43e94f).
*/
#ifndef pr_warn
#define pr_warn pr_warning
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6)
/*
* See also patch "Add a dummy printk function for the maintenance of unused
* printks" (commit 12fdff3fc2483f906ae6404a6e8dcf2550310b6f).
*/
static inline __attribute__ ((format (printf, 1, 2)))
int no_printk(const char *s, ...) { return 0; }
#endif
/* <linux/sched.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6)
#define set_cpus_allowed_ptr(p, new_mask) set_cpus_allowed((p), *(new_mask))
#endif
/* <linux/scatterlist.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
/*
* The macro's sg_page(), sg_virt(), sg_init_table(), sg_assign_page() and
* sg_set_page() have been introduced in the 2.6.24 kernel. The definitions
* below are backports of the 2.6.24 macro's for older kernels. There is one
* exception however: when compiling SCST on a system with a pre-2.6.24 kernel
* (e.g. RHEL 5.x) where the OFED kernel headers have been installed, do not
* define the backported macro's because OFED has already defined these.
*/
static inline bool sg_is_chain(struct scatterlist *sg)
{
return false;
}
static inline struct scatterlist *sg_chain_ptr(struct scatterlist *sg)
{
return NULL;
}
#define sg_is_last(sg) false
#ifndef sg_page
static inline struct page *sg_page(struct scatterlist *sg)
{
return sg->page;
}
#endif
static inline void *sg_virt(struct scatterlist *sg)
{
return page_address(sg_page(sg)) + sg->offset;
}
static inline void sg_mark_end(struct scatterlist *sg)
{
}
#ifndef __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__
static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
{
memset(sgl, 0, sizeof(*sgl) * nents);
}
static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
{
sg->page = page;
}
static inline void sg_set_page(struct scatterlist *sg, struct page *page,
unsigned int len, unsigned int offset)
{
sg_assign_page(sg, page);
sg->offset = offset;
sg->length = len;
}
#ifndef for_each_sg
/* See also commit 96b418c960af0d5c7185ff5c4af9376eb37ac9d3 */
#define for_each_sg(sglist, sg, nr, __i) \
for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next_inline(sg))
#endif /* for_each_sg */
#endif /* __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__ */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) */
/* <linux/slab.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
sizeof(struct __struct), __alignof__(struct __struct),\
(__flags), NULL, NULL)
#endif
/* <linux/t10-pi.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
struct t10_pi_tuple {
__be16 guard_tag;
__be16 app_tag;
__be32 ref_tag;
};
#endif
/* <linux/types.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
/*
* See also patch "fix abuses of ptrdiff_t" (commit ID
* 142956af525002c5378e7d91d81a01189841a785).
*/
typedef unsigned long uintptr_t;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap);
#endif
/* <linux/vmalloc.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 5 || \
RHEL_MAJOR -0 == 5 && RHEL_MINOR -0 < 10 || \
RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 1)
/*
* See also patch "mm: add vzalloc() and vzalloc_node() helpers" (commit
* e1ca7788dec6773b1a2bce51b7141948f2b8bccf).
*/
static inline void *vzalloc(unsigned long size)
{
return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
PAGE_KERNEL);
}
#endif
/* <linux/workqueue.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(BACKPORT_LINUX_WORKQUEUE_TO_2_6_19)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))
static inline int cancel_delayed_work_sync(struct delayed_work *work)
{
int res;
res = cancel_delayed_work(work);
flush_scheduled_work();
return res;
}
#else
/*
* While cancel_delayed_work_sync() has not been defined in the vanilla kernel
* 2.6.18 nor in 2.6.19 nor in RHEL/CentOS 5.0..5.5, a definition is available
* in RHEL/CentOS 5.6. Unfortunately that definition is incompatible with what
* we need. So define cancel_delayed_work() as a macro such that it overrides
* the RHEL/CentOS 5.6 inline function definition in <linux/workqueue.h>.
*/
#define cancel_delayed_work_sync(work) \
({ \
int res; \
\
res = cancel_delayed_work((work)); \
flush_scheduled_work(); \
res; \
})
#endif
#endif
/* <scsi/scsi_cmnd.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
/*
* See also patch "[SCSI] bidirectional command support"
* (commit ID 6f9a35e2dafa).
*/
static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd)
{
return false;
}
#endif
#endif /* _SCST_BACKPORT_H_ */
-406
View File
@@ -72,279 +72,12 @@
#include <scst_const.h>
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
#define smp_mb__after_atomic_inc smp_mb__after_atomic
#define smp_mb__after_clear_bit smp_mb__after_atomic
#define smp_mb__before_atomic_dec smp_mb__before_atomic
#define smp_mb__after_atomic_dec smp_mb__after_atomic
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
#ifndef RHEL_RELEASE_CODE
typedef _Bool bool;
#endif
#define true 1
#define false 0
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
#ifndef __packed
#define __packed __attribute__((packed))
#endif
#ifndef __aligned
#define __aligned(x) __attribute__((aligned(x)))
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32)
#define lockdep_assert_held(l) do { (void)(l); } while (0)
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 32)
#ifndef O_DSYNC
#define O_DSYNC O_SYNC
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
/*
* See also patch "Move ACCESS_ONCE() to <linux/compiler.h>" (commit ID
* 9c3cdc1f83a6e07092392ff4aba6466517dbd1d0).
*/
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
#endif
#ifdef INSIDE_KERNEL_TREE
#include <scst/scst_sgv.h>
#else
#include "scst_sgv.h"
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20)
#ifndef __printf
#define __printf(a, b) __attribute__((format(printf,a,b)))
#endif
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) && !defined(BACKPORT_LINUX_CPUMASK_H)
#define nr_cpu_ids NR_CPUS
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
/*
* See also patch "fix abuses of ptrdiff_t" (commit ID
* 142956af525002c5378e7d91d81a01189841a785).
*/
typedef unsigned long uintptr_t;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
/*
* See also patch "[SCSI] bidirectional command support"
* (commit ID 6f9a35e2dafa).
*/
static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd)
{
return false;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28) && defined(__LINUX_CPUMASK_H)
/*
* See also patch "cpumask: introduce new API, without changing anything"
* (commit ID 2d3854a37e8b).
*/
typedef cpumask_t cpumask_var_t[1];
#define cpumask_bits(maskp) ((maskp)->bits)
#ifdef CONFIG_CPUMASK_OFFSTACK
/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
* not all bits may be allocated. */
#define nr_cpumask_bits nr_cpu_ids
#else
#define nr_cpumask_bits NR_CPUS
#endif
#ifdef CONFIG_CPUMASK_OFFSTACK
bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
void free_cpumask_var(cpumask_var_t mask);
#else
static inline void free_cpumask_var(cpumask_var_t mask)
{
}
static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
{
return true;
}
#endif
/* verify cpu argument to cpumask_* operators */
static inline unsigned int cpumask_check(unsigned int cpu)
{
#ifdef CONFIG_DEBUG_PER_CPU_MAPS
WARN_ON_ONCE(cpu >= nr_cpumask_bits);
#endif /* CONFIG_DEBUG_PER_CPU_MAPS */
return cpu;
}
/**
* cpumask_next - get the next cpu in a cpumask
* @n: the cpu prior to the place to search (ie. return will be > @n)
* @srcp: the cpumask pointer
*
* Returns >= nr_cpu_ids if no further cpus set.
*/
static inline unsigned int cpumask_next(int n, const cpumask_t *srcp)
{
/* -1 is a legal arg here. */
if (n != -1)
cpumask_check(n);
return find_next_bit(cpumask_bits(srcp), nr_cpumask_bits, n+1);
}
/**
* for_each_cpu - iterate over every cpu in a mask
* @cpu: the (optionally unsigned) integer iterator
* @mask: the cpumask pointer
*
* After the loop, cpu is >= nr_cpu_ids.
*/
#define for_each_cpu(cpu, mask) \
for ((cpu) = -1; \
(cpu) = cpumask_next((cpu), (mask)), \
(cpu) < nr_cpu_ids;)
/**
* cpumask_set_cpu - set a cpu in a cpumask
* @cpu: cpu number (< nr_cpu_ids)
* @dstp: the cpumask pointer
*/
static inline void cpumask_set_cpu(unsigned int cpu, cpumask_t *dstp)
{
set_bit(cpu, cpumask_bits(dstp));
}
/**
* cpumask_copy - *dstp = *srcp
* @dstp: the result
* @srcp: the input cpumask
*/
static inline void cpumask_copy(cpumask_t *dstp,
const cpumask_t *srcp)
{
bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), nr_cpumask_bits);
}
/**
* cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask
* @dstp: the cpumask pointer
*/
static inline void cpumask_setall(cpumask_t *dstp)
{
bitmap_fill(cpumask_bits(dstp), nr_cpumask_bits);
}
/**
* cpumask_equal - *src1p == *src2p
* @src1p: the first input
* @src2p: the second input
*/
static inline bool cpumask_equal(const cpumask_t *src1p,
const cpumask_t *src2p)
{
return bitmap_equal(cpumask_bits(src1p), cpumask_bits(src2p),
nr_cpumask_bits);
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6)
#define set_cpus_allowed_ptr(p, new_mask) set_cpus_allowed((p), *(new_mask))
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
#ifndef swap
#define swap(a, b) \
do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
{
return q->max_hw_sectors;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
/*
* See also patch "kernel.h: add pr_warn for symmetry to dev_warn,
* netdev_warn" (commit fc62f2f19edf46c9bdbd1a54725b56b18c43e94f).
*/
#ifndef pr_warn
#define pr_warn pr_warning
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6)
/*
* See also patch "Add a dummy printk function for the maintenance of unused
* printks" (commit 12fdff3fc2483f906ae6404a6e8dcf2550310b6f).
*/
static inline __attribute__ ((format (printf, 1, 2)))
int no_printk(const char *s, ...) { return 0; }
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
/*
* See also patch "sched: Fix softirq time accounting" (commit ID
* 75e1056f5c57050415b64cb761a3acc35d91f013).
*/
#ifndef in_serving_softirq
#define in_serving_softirq() in_softirq()
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6 || \
RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 1)
extern int hex_to_bin(char ch);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
/*
* See also "lib: hex2bin converts ascii hexadecimal string to binary" (commit
* dc88e46029486ed475c71fe1bb696d39511ac8fe).
*/
static inline void hex2bin(u8 *dst, const char *src, size_t count)
{
while (count--) {
*dst = hex_to_bin(*src++) << 4;
*dst += hex_to_bin(*src++);
dst++;
}
}
#endif
#ifndef __list_for_each
/* ToDo: cleanup when both are the same for all relevant kernels */
#define __list_for_each list_for_each
#endif
/*
* Returns true if entry is in its list. Entry must be deleted from the
* list by using list_del_init()!
*/
static inline bool list_entry_in_list(const struct list_head *entry)
{
return !list_empty(entry);
}
#define SCST_INTERFACE_VERSION \
SCST_VERSION_STRING SCST_INTF_VER SCST_CONST_VERSION
@@ -774,15 +507,6 @@ enum scst_exec_context {
#endif
/*************************************************************
** Kernel cache creation helper
*************************************************************/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
sizeof(struct __struct), __alignof__(struct __struct),\
(__flags), NULL, NULL)
#endif
/*************************************************************
** Valid_mask constants for scst_analyze_sense()
*************************************************************/
@@ -802,14 +526,6 @@ enum scst_exec_context {
** T10-PI (DIF) support
*************************************************************/
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
struct t10_pi_tuple {
__be16 guard_tag;
__be16 app_tag;
__be32 ref_tag;
};
#endif
/*
* Defines where and how to deal with DIF tags. Can be OR'ed to get
* multilevel checks
@@ -4069,11 +3785,7 @@ static inline bool scst_cmd_atomic(struct scst_cmd *cmd)
*/
if (unlikely((in_atomic() || in_interrupt() || irqs_disabled()) &&
!res)) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
printk(KERN_ERR "ERROR: atomic context and non-atomic cmd!\n");
#else
pr_err("ERROR: atomic context and non-atomic cmd!\n");
#endif
dump_stack();
cmd->atomic = 1;
res = 1;
@@ -4995,69 +4707,6 @@ static inline void scst_set_aen_delivery_status(struct scst_aen *aen,
void scst_aen_done(struct scst_aen *aen);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
/*
* The macro's sg_page(), sg_virt(), sg_init_table(), sg_assign_page() and
* sg_set_page() have been introduced in the 2.6.24 kernel. The definitions
* below are backports of the 2.6.24 macro's for older kernels. There is one
* exception however: when compiling SCST on a system with a pre-2.6.24 kernel
* (e.g. RHEL 5.x) where the OFED kernel headers have been installed, do not
* define the backported macro's because OFED has already defined these.
*/
static inline bool sg_is_chain(struct scatterlist *sg)
{
return false;
}
static inline struct scatterlist *sg_chain_ptr(struct scatterlist *sg)
{
return NULL;
}
#define sg_is_last(sg) false
#ifndef sg_page
static inline struct page *sg_page(struct scatterlist *sg)
{
return sg->page;
}
#endif
static inline void *sg_virt(struct scatterlist *sg)
{
return page_address(sg_page(sg)) + sg->offset;
}
static inline void sg_mark_end(struct scatterlist *sg)
{
}
#ifndef __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__
static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
{
memset(sgl, 0, sizeof(*sgl) * nents);
}
static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
{
sg->page = page;
}
static inline void sg_set_page(struct scatterlist *sg, struct page *page,
unsigned int len, unsigned int offset)
{
sg_assign_page(sg, page);
sg->offset = offset;
sg->length = len;
}
#endif /* __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__ */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) */
static inline struct scatterlist *__sg_next_inline(struct scatterlist *sg)
{
sg++;
@@ -5075,18 +4724,6 @@ static inline struct scatterlist *sg_next_inline(struct scatterlist *sg)
return __sg_next_inline(sg);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
#ifndef __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__
#ifndef for_each_sg
/* See also commit 96b418c960af0d5c7185ff5c4af9376eb37ac9d3 */
#define for_each_sg(sglist, sg, nr, __i) \
for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next_inline(sg))
#endif
#endif /* __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__ */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) */
static inline void sg_clear(struct scatterlist *sg)
{
memset(sg, 0, sizeof(*sg));
@@ -5356,34 +4993,6 @@ static inline gfp_t scst_cmd_get_gfp_mask(struct scst_cmd *cmd)
return cmd->cmd_gfp_mask;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(BACKPORT_LINUX_WORKQUEUE_TO_2_6_19)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))
static inline int cancel_delayed_work_sync(struct delayed_work *work)
{
int res;
res = cancel_delayed_work(work);
flush_scheduled_work();
return res;
}
#else
/*
* While cancel_delayed_work_sync() has not been defined in the vanilla kernel
* 2.6.18 nor in 2.6.19 nor in RHEL/CentOS 5.0..5.5, a definition is available
* in RHEL/CentOS 5.6. Unfortunately that definition is incompatible with what
* we need. So define cancel_delayed_work() as a macro such that it overrides
* the RHEL/CentOS 5.6 inline function definition in <linux/workqueue.h>.
*/
#define cancel_delayed_work_sync(work) \
({ \
int res; \
\
res = cancel_delayed_work((work)); \
flush_scheduled_work(); \
res; \
})
#endif
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) && defined(CONFIG_LOCKDEP)
extern struct lockdep_map scst_suspend_dep_map;
@@ -5836,21 +5445,6 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data,
void (*done)(void *data, char *sense, int result, int resid));
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 5 || \
RHEL_MAJOR -0 == 5 && RHEL_MINOR -0 < 10 || \
RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 1)
/*
* See also patch "mm: add vzalloc() and vzalloc_node() helpers" (commit
* e1ca7788dec6773b1a2bce51b7141948f2b8bccf).
*/
static inline void *vzalloc(unsigned long size)
{
return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
PAGE_KERNEL);
}
#endif
int scst_get_file_mode(const char *path);
bool scst_parent_dir_exists(const char *path);
+5 -6
View File
@@ -118,12 +118,11 @@ install: all
install -m 644 dev_handlers/*.ko $(INSTALL_DIR)/dev_handlers
install -m 644 scst.ko $(INSTALL_DIR)
install -d $(INSTALL_DIR_H)
install -m 644 ../include/scst.h $(INSTALL_DIR_H)
install -m 644 ../include/scst_sgv.h $(INSTALL_DIR_H)
install -m 644 ../include/scst_debug.h $(INSTALL_DIR_H)
install -m 644 ../include/scst_user.h $(INSTALL_DIR_H)
install -m 644 ../include/scst_const.h $(INSTALL_DIR_H)
install -m 644 ../include/scst_itf_ver.h $(INSTALL_DIR_H)
header_files="backport.h scst.h scst_const.h scst_debug.h \
scst_itf_ver.h scst_sgv.h scst_user.h"; \
for h in $${header_files}; do \
install -m 644 ../include/$$h $(INSTALL_DIR_H); \
done
rm -f $(INSTALL_DIR_H)/$(MODULE_SYMVERS)
install -m 644 $(MODULE_SYMVERS) $(INSTALL_DIR_H)
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
+20 -20
View File
@@ -7389,26 +7389,6 @@ out:
return res;
}
static ssize_t vdisk_sysfs_sync_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
struct scst_device *dev =
container_of(kobj, struct scst_device, dev_kobj);
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
int res;
if (virt_dev->nullio)
res = 0;
else if (virt_dev->blockio)
res = vdisk_blockio_flush(virt_dev->bdev, GFP_KERNEL, false,
NULL, false);
else
res = __vdisk_fsync_fileio(0, i_size_read(file_inode(virt_dev->fd)),
dev, NULL, virt_dev->fd);
return res ? : count;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
static int vdisk_create_bioset(struct scst_vdisk_dev *virt_dev)
{
@@ -8321,6 +8301,26 @@ out_e_unlock:
#ifndef CONFIG_SCST_PROC
static ssize_t vdisk_sysfs_sync_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
struct scst_device *dev =
container_of(kobj, struct scst_device, dev_kobj);
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
int res;
if (virt_dev->nullio)
res = 0;
else if (virt_dev->blockio)
res = vdisk_blockio_flush(virt_dev->bdev, GFP_KERNEL, false,
NULL, false);
else
res = __vdisk_fsync_fileio(0, i_size_read(file_inode(virt_dev->fd)),
dev, NULL, virt_dev->fd);
return res ? : count;
}
static int vcdrom_sysfs_process_filename_store(struct scst_sysfs_work_item *work)
{
int res;
+2 -1
View File
@@ -321,11 +321,12 @@ static int scst_local_proc_info(struct Scsi_Host *host, char *buffer,
#else
static int scst_local_show_info(struct seq_file *file, struct Scsi_Host *host)
{
return seq_printf(file, "scst_local adapter driver, version "
seq_printf(file, "scst_local adapter driver, version "
"%s [%s]\nAborts=%d, Device Resets=%d, Target Resets=%d\n",
SCST_LOCAL_VERSION, scst_local_version_date,
atomic_read(&num_aborts), atomic_read(&num_dev_resets),
atomic_read(&num_target_resets));
return 0;
}
#endif
+3 -1
View File
@@ -71,10 +71,12 @@ rm -f /usr/local/man/man5/scst.conf.5*
%{_sbindir}/scstadmin
%{perl_vendorlib}/SCST
%{perl_vendorarch}/auto/SCST_SCST
%{_mandir}/man1/scstadmin.1*
%{scstadmin_perl_installvendorman3dir}/SCST::SCST.3pm*
%if %([ "$(readlink scstadmin)" = scstadmin.sysfs ]; echo -n $((1-$?)))
%{_mandir}/man1/scstadmin.1*
%{_mandir}/man5/scst.5*
%{_mandir}/man5/scst.conf.5*
%endif
%changelog
* Fri Oct 04 2013 Bart Van Assche <bvanassche@acm.org>