pipe: merge anon_pipe_buf*_ops
All the op vectors are exactly the same, they are just used to encode packet or nomerge behavior. There already is a flag for the packet behavior, so just add a new one to allow for merging. Inverting it vs the previous nomerge special casing actually allows for much nicer code. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:

committed by
Al Viro

parent
00c285d0d0
commit
f6dd975583
12
fs/splice.c
12
fs/splice.c
@@ -1624,12 +1624,11 @@ retry:
|
||||
*obuf = *ibuf;
|
||||
|
||||
/*
|
||||
* Don't inherit the gift flag, we need to
|
||||
* Don't inherit the gift and merge flags, we need to
|
||||
* prevent multiple steals of this page.
|
||||
*/
|
||||
obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
|
||||
|
||||
pipe_buf_mark_unmergeable(obuf);
|
||||
obuf->flags &= ~PIPE_BUF_FLAG_CAN_MERGE;
|
||||
|
||||
obuf->len = len;
|
||||
ibuf->offset += len;
|
||||
@@ -1717,12 +1716,11 @@ static int link_pipe(struct pipe_inode_info *ipipe,
|
||||
*obuf = *ibuf;
|
||||
|
||||
/*
|
||||
* Don't inherit the gift flag, we need to
|
||||
* prevent multiple steals of this page.
|
||||
* Don't inherit the gift and merge flag, we need to prevent
|
||||
* multiple steals of this page.
|
||||
*/
|
||||
obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
|
||||
|
||||
pipe_buf_mark_unmergeable(obuf);
|
||||
obuf->flags &= ~PIPE_BUF_FLAG_CAN_MERGE;
|
||||
|
||||
if (obuf->len > len)
|
||||
obuf->len = len;
|
||||
|
Reference in New Issue
Block a user