From bb3c01ec7960a5eaff45916bd74446f96301c16d Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Sun, 6 Dec 2020 20:50:21 +0000 Subject: [PATCH] Document the BA_CLRBUF flag used in ufs and ext2fs filesystems. Suggested by: kib MFC after: 3 days Sponsored by: Netflix --- sys/fs/ext2fs/ext2_extern.h | 7 +++++++ sys/ufs/ufs/ufs_extern.h | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/sys/fs/ext2fs/ext2_extern.h b/sys/fs/ext2fs/ext2_extern.h index 5f1a8a2c9b6..897784580a3 100644 --- a/sys/fs/ext2fs/ext2_extern.h +++ b/sys/fs/ext2fs/ext2_extern.h @@ -135,6 +135,13 @@ void ext2_gd_csum_set(struct m_ext2fs *); /* Flags to low-level allocation routines. * The low 16-bits are reserved for IO_ flags from vnode.h. + * + * The BA_CLRBUF flag specifies that the existing content of the block + * will not be completely overwritten by the caller, so buffers for new + * blocks must be cleared and buffers for existing blocks must be read. + * When BA_CLRBUF is not set the buffer will be completely overwritten + * and there is no reason to clear them or to spend I/O fetching existing + * data. The BA_CLRBUF flag is handled in the UFS_BALLOC() functions. */ #define BA_CLRBUF 0x00010000 /* Clear invalid areas of buffer. */ #define BA_SEQMASK 0x7F000000 /* Bits holding seq heuristic. */ diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h index cc6078065e7..a28fcffabd2 100644 --- a/sys/ufs/ufs/ufs_extern.h +++ b/sys/ufs/ufs/ufs_extern.h @@ -119,6 +119,13 @@ void softdep_revert_rmdir(struct inode *, struct inode *); * * Note: The general vfs code typically limits the sequential heuristic * count to 127. See sequential_heuristic() in kern/vfs_vnops.c + * + * The BA_CLRBUF flag specifies that the existing content of the block + * will not be completely overwritten by the caller, so buffers for new + * blocks must be cleared and buffers for existing blocks must be read. + * When BA_CLRBUF is not set the buffer will be completely overwritten + * and there is no reason to clear them or to spend I/O fetching existing + * data. The BA_CLRBUF flag is handled in the UFS_BALLOC() functions. */ #define BA_CLRBUF 0x00010000 /* Clear invalid areas of buffer. */ #define BA_METAONLY 0x00020000 /* Return indirect block buffer. */