History

pipe: Add notification lossage handling

Add handling for loss of notifications by having read() insert a loss-notification message after it has read the pipe buffer that was last in the ring when the loss occurred. Lossage can come about either by running out of notification descriptors or by running out of space in the pipe ring.

David Howells committed 6 years ago

Commit e7d553d1 parent 8cfba764 files · +40 −0Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/pipe_fs_i.h+7−0
@@ -9,6 +9,9 @@ · 8 unmodified lines
9#define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */9#define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */
10#define PIPE_BUF_FLAG_PACKET 0x08 /* read() as a packet */10#define PIPE_BUF_FLAG_PACKET 0x08 /* read() as a packet */
11#define PIPE_BUF_FLAG_WHOLE 0x10 /* read() must return entire buffer or error */11#define PIPE_BUF_FLAG_WHOLE 0x10 /* read() must return entire buffer or error */
12#ifdef CONFIG_WATCH_QUEUE
13#define PIPE_BUF_FLAG_LOSS 0x20 /* Message loss happened after this buffer */
14#endif
12 15
13/**16/**
14 * struct pipe_buffer - a linux kernel pipe buffer17 * struct pipe_buffer - a linux kernel pipe buffer
@@ -34,6 +37,7 @@ struct pipe_buffer { · 19 unmodified lines
34 * @wr_wait: writer wait point in case of full pipe37 * @wr_wait: writer wait point in case of full pipe
35 * @head: The point of buffer production38 * @head: The point of buffer production
36 * @tail: The point of buffer consumption39 * @tail: The point of buffer consumption
40 * @note_loss: The next read() should insert a data-lost message
37 * @max_usage: The maximum number of slots that may be used in the ring41 * @max_usage: The maximum number of slots that may be used in the ring
38 * @ring_size: total number of buffers (should be a power of 2)42 * @ring_size: total number of buffers (should be a power of 2)
39 * @nr_accounted: The amount this pipe accounts for in user->pipe_bufs43 * @nr_accounted: The amount this pipe accounts for in user->pipe_bufs
@@ -56,6 +60,9 @@ struct pipe_inode_info { · 16 unmodified lines
56 unsigned int tail;60 unsigned int tail;
57 unsigned int max_usage;61 unsigned int max_usage;
58 unsigned int ring_size;62 unsigned int ring_size;
63#ifdef CONFIG_WATCH_QUEUE
64 bool note_loss;
65#endif
59 unsigned int nr_accounted;66 unsigned int nr_accounted;
60 unsigned int readers;67 unsigned int readers;
61 unsigned int writers;68 unsigned int writers;