diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2019-09-11 21:24:14 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2019-09-11 21:24:14 +0000 |
commit | aaa3852435aee8c1b5abfe38ed7d43f9ba57e6dd (patch) | |
tree | c4af6be7d3abd633c1034d04254318177754b071 /sys/sys/buf.h | |
parent | 8d910a42823bf5d57e859949f355568657cc86dd (diff) | |
download | src-aaa3852435aee8c1b5abfe38ed7d43f9ba57e6dd.tar.gz src-aaa3852435aee8c1b5abfe38ed7d43f9ba57e6dd.zip |
buf: Add B_INVALONERR flag to discard data
Setting the B_INVALONERR flag before a synchronous write causes the buf
cache to forcibly invalidate contents if the write fails (BIO_ERROR).
This is intended to be used to allow layers above the buffer cache to make
more informed decisions about when discarding dirty buffers without
successful write is acceptable.
As a proof of concept, use in msdosfs to handle failures to mark the on-disk
'dirty' bit during rw mount or ro->rw update.
Extending this to other filesystems is left as future work.
PR: 210316
Reviewed by: kib (with objections)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21539
Notes
Notes:
svn path=/head/; revision=352233
Diffstat (limited to 'sys/sys/buf.h')
-rw-r--r-- | sys/sys/buf.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 5c95b33baa71..f419617abfab 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -196,6 +196,11 @@ struct buf { * may not be used with the stage 1 data write under NFS * but may be used for the commit rpc portion. * + * B_INVALONERR This flag is set on dirty buffers. It specifies that a + * write error should forcibly invalidate the buffer + * contents. This flag should be used with caution, as it + * discards data. It is incompatible with B_ASYNC. + * * B_VMIO Indicates that the buffer is tied into an VM object. * The buffer's data is always PAGE_SIZE aligned even * if b_bufsize and b_bcount are not. ( b_bufsize is @@ -226,7 +231,7 @@ struct buf { #define B_NOCACHE 0x00008000 /* Do not cache block after use. */ #define B_MALLOC 0x00010000 /* malloced b_data */ #define B_CLUSTEROK 0x00020000 /* Pagein op, so swap() can count it. */ -#define B_00040000 0x00040000 /* Available flag. */ +#define B_INVALONERR 0x00040000 /* Invalidate on write error. */ #define B_00080000 0x00080000 /* Available flag. */ #define B_00100000 0x00100000 /* Available flag. */ #define B_00200000 0x00200000 /* Available flag. */ @@ -243,7 +248,7 @@ struct buf { #define PRINT_BUF_FLAGS "\20\40remfree\37cluster\36vmio\35ram\34managed" \ "\33paging\32infreecnt\31nocopy\30b23\27relbuf\26b21\25b20" \ - "\24b19\23b18\22clusterok\21malloc\20nocache\17b14\16inval" \ + "\24b19\23invalonerr\22clusterok\21malloc\20nocache\17b14\16inval" \ "\15reuse\14noreuse\13eintr\12done\11b8\10delwri" \ "\7validsuspwrt\6cache\5deferred\4direct\3async\2needcommit\1age" |