History log of /include/linux/scatterlist.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
187f1882b5b0748b3c4c22274663fdb372ac0452 24-Nov-2011 Paul Gortmaker <paul.gortmaker@windriver.com> BUG: headers with BUG/BUG_ON etc. need linux/bug.h

If a header file is making use of BUG, BUG_ON, BUILD_BUG_ON, or any
other BUG variant in a static inline (i.e. not in a #define) then
that header really should be including <linux/bug.h> and not just
expecting it to be implicitly present.

We can make this change risk-free, since if the files using these
headers didn't have exposure to linux/bug.h already, they would have
been causing compile failures/warnings.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
/include/linux/scatterlist.h
6de7e356faf54aa75de5b624bbce28a5b776dfa8 18-Jun-2009 Sebastian Andrzej Siewior <sebastian@breakpoint.cc> lib/scatterlist: add a flags to signalize mapping direction

sg_miter_start() is currently unaware of the direction of the copy
process (to or from the scatter list). It is important to know the
direction because the page has to be flushed in case the data written
is seen on a different mapping in user land on cache incoherent
architectures.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
/include/linux/scatterlist.h
137d3edb48425f82a6a4226b664f90ed5e42eea5 19-Jul-2008 Tejun Heo <htejun@gmail.com> sg: reimplement sg mapping iterator

This is alternative implementation of sg content iterator introduced
by commit 83e7d317... from Pierre Ossman in next-20080716. As there's
already an sg iterator which iterates over sg entries themselves, name
this sg_mapping_iterator.

Slightly edited description from the original implementation follows.

Iteration over a sg list is not that trivial when you take into
account that memory pages might have to be mapped before being used.
Unfortunately, that means that some parts of the kernel restrict
themselves to directly accesible memory just to not have to deal with
the mess.

This patch adds a simple iterator system that allows any code to
easily traverse an sg list and not have to deal with all the details.
The user can decide to consume part of the iteration. Also, iteration
can be stopped and resumed later if releasing the kmap between
iteration steps is necessary. These features are useful to implement
piecemeal sg copying for interrupt drive PIO for example.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
/include/linux/scatterlist.h
b1adaf65ba0398c9a1adc8f3a274533165a4df61 17-Mar-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] block: add sg buffer copy helper functions

This patch adds new three helper functions to copy data between an SG
list and a linear buffer.

- sg_copy_from_buffer copies data from linear buffer to an SG list

- sg_copy_to_buffer copies data from an SG list to a linear buffer

When the APIs copy data from a linear buffer to an SG list,
flush_kernel_dcache_page is called. It's not necessary for everyone
but it's a no-op on most architectures and in general the API is not
used in performance critical path.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/include/linux/scatterlist.h
7cedb1f17fb7f4374d11501f61656ae9d3ba47e9 13-Jan-2008 James Bottomley <James.Bottomley@HansenPartnership.com> SG: work with the SCSI fixed maximum allocations.

SCSI sg table allocation has a maximum size (of SCSI_MAX_SG_SEGMENTS,
currently 128) and this will cause a BUG_ON() in SCSI if something
tries an allocation over it. This patch adds a size limit to the
chaining allocator to allow the specification of the maximum
allocation size for chaining, so we always chain in units of the
maximum SCSI allocation size.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
0db9299f48ebd4a860d6ad4e1d36ac50671d48e7 30-Nov-2007 Jens Axboe <jens.axboe@oracle.com> SG: Move functions to lib/scatterlist.c and add sg chaining allocator helpers

Manually doing chained sg lists is not trivial, so add some helpers
to make sure that drivers get it right.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
b801a1e7dbca3f51d0a4b22a750ae257196002cb 11-Jan-2008 Rusty Russell <rusty@rustcorp.com.au> Don't blatt first element of prv in sg_chain()

I realize that sg chaining is a ploy to make the rest of the kernel
devs feel the pain of the SCSI subsystem. But this was a little
unsubtle.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
645a8d94629fd812a220d54876339a1ddafd9bc2 27-Nov-2007 Tejun Heo <htejun@gmail.com> scatterlist: add more safeguards

Add more safeguards to protect against misinterpreting a chain entry
as a normal scatterlist and vice-versa.

* Make sure the entry isn't a chain when assigning and reading a
normal sg.

* Clear offset and length when chaining.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
c46f2334c84c2b26baa64d42d75ddc5fab38c3dc 31-Oct-2007 Jens Axboe <jens.axboe@oracle.com> [SG] Get rid of __sg_mark_end()

sg_mark_end() overwrites the page_link information, but all users want
__sg_mark_end() behaviour where we just set the end bit. That is the most
natural way to use the sg list, since you'll fill it in and then mark the
end point.

So change sg_mark_end() to only set the termination bit. Add a sg_magic
debug check as well, and clear a chain pointer if it is set.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
013fb33972061ac65cdf3e1771267985e59deca1 30-Oct-2007 Jens Axboe <jens.axboe@oracle.com> SG: Make sg_init_one() use general table init functions

Don't open code sg_init_one(), make it reuse sg_init_table().

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
513f54b78f9594927ede66b6c66a70c1bae0c4ca 26-Oct-2007 Chuck Lever <chuck.lever@oracle.com> sg_init_table() should use unsigned loop index variable

Clean up: fix a mixed sign comparison in sg_init_table() accidentally
introduced by commit d6ec0842. The sign of the loop index variable
should match the sign of the "nents" argument.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jens Axboe <axboe@carl.home.kernel.dk>
/include/linux/scatterlist.h
74eb94f7b84f4e631a0e020991fb16f17ce85ab7 26-Oct-2007 Chuck Lever <chuck.lever@oracle.com> sg_last() should use unsigned loop index variable

Clean up: fix a mixed sign comparison in sg_last() accidentally
introduced by commit 70eb8040. The sign of the loop index variable
should match the sign of the "nents" argument.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Jens Axboe <axboe@carl.home.kernel.dk>
/include/linux/scatterlist.h
73fd546aa75e9db02526bf304d4f736c4ec82b4b 26-Oct-2007 Jens Axboe <jens.axboe@oracle.com> SG: clear termination bit in sg_chain()

Since we are using the last entry in the list, clear any possible
termination bit that may have already been set. Pointed out by Rusty.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
85cdffcde0b6b831a06422413300d0f5c0e608c3 25-Oct-2007 Hugh Dickins <hugh@veritas.com> fix sg_phys to use dma_addr_t

x86_32 CONFIG_HIGHMEM64G with 5GB RAM hung when booting, after issuing
some "request_module: runaway loop modprobe binfmt-0000" messages in
trying to exec /sbin/init.

The binprm buf doesn't see the right ".ELF" header because sg_phys()
is providing the wrong physical addresses for high pages: a 32-bit
unsigned long is too small in this case, we need to use dma_addr_t.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
642f149031d70415d9318b919d50b71e4724adbd 24-Oct-2007 Jens Axboe <jens.axboe@oracle.com> SG: Change sg_set_page() to take length and offset argument

Most drivers need to set length and offset as well, so may as well fold
those three lines into one.

Add sg_assign_page() for those two locations that only needed to set
the page, where the offset/length is set outside of the function context.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
de26103de56a0c482ad21296eae9b06deefc8e62 23-Oct-2007 Jens Axboe <jens.axboe@oracle.com> [SG] Add debug check for page alignment

Suggested by Boaz Harrosh <bharrosh@panasas.com>

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
d6ec084200c37683278c821338f74ddf21ab80f5 22-Oct-2007 Jens Axboe <jens.axboe@oracle.com> Add CONFIG_DEBUG_SG sg validation

Add a Kconfig entry which will toggle some sanity checks on the sg
entry and tables.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
18dabf473e15850c0dbc8ff13ac1e2806d542c15 22-Oct-2007 Jens Axboe <jens.axboe@oracle.com> Change table chaining layout

Change the page member of the scatterlist structure to be an unsigned
long, and encode more stuff in the lower bits:

- Bits 0 and 1 zero: this is a normal sg entry. Next sg entry is located
at sg + 1.
- Bit 0 set: this is a chain entry, the next real entry is at ->page_link
with the two low bits masked off.
- Bit 1 set: this is the final entry in the sg entry. sg_next() will return
NULL when passed such an entry.

It's thus important that sg table users use the proper accessors to get
and set the page member.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
82f66fbef58de4ad7519708d0b9e685e20fa4e8a 22-Oct-2007 Jens Axboe <jens.axboe@oracle.com> [SG] Add helpers for manipulating SG entries

We can then transition drivers without changing the generated code.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
70eb8040dc81212c884a464b75e37dca8014f3ad 16-Jul-2007 Jens Axboe <jens.axboe@oracle.com> Add chained sg support to linux/scatterlist.h

The core of the patch - allow the last sg element in a scatterlist
table to point to the start of a new table. We overload the LSB of
the page pointer to indicate whether this is a valid sg entry, or
merely a link to the next list.

Includes a fix from Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
correcting the ifdef ARCH_HAS_SG_CHAIN guarding sg_last().

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
96b418c960af0d5c7185ff5c4af9376eb37ac9d3 09-May-2007 Jens Axboe <jens.axboe@oracle.com> Add sg helpers for iterating over a scatterlist table

First step to being able to change the scatterlist setup without
having to modify drivers (a lot :-)

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/include/linux/scatterlist.h
03fd9cee7f46dddcd2562bc175d2c348502ce281 14-Aug-2006 Herbert Xu <herbert@gondor.apana.org.au> [PATCH] scatterlist: Add const to sg_set_buf/sg_init_one pointer argument

This patch adds a const modifier to the buf argument of sg_set_buf and
sg_init_one. This lets people call it with pointers that are const.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
/include/linux/scatterlist.h
d32311fed70d12f14e585feb4653571b1e2b0e6d 17-Sep-2005 Herbert Xu <herbert@gondor.apana.org.au> [PATCH] Introduce sg_set_buf

sg_init_one is a nice tool for the block layer. However, users
of struct scatterlist in other subsystems don't usually need the
DMA attributes. For them it's a waste of time and space to
initialise the whole struct scatterlist structure.

Therefore this patch adds a new function sg_set_buf to initialise
a scatterlist without zeroing the DMA attributes.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
/include/linux/scatterlist.h
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
/include/linux/scatterlist.h