@@ -93,8 +93,9 @@ struct btrfs_inode {
9393 /*
9494 * Lock for counters and all fields used to determine if the inode is in
9595 * the log or not (last_trans, last_sub_trans, last_log_commit,
96- * logged_trans), to access/update new_delalloc_bytes and to update the
97- * VFS' inode number of bytes used.
96+ * logged_trans), to access/update delalloc_bytes, new_delalloc_bytes,
97+ * defrag_bytes, disk_i_size, outstanding_extents, csum_bytes and to
98+ * update the VFS' inode number of bytes used.
9899 */
99100 spinlock_t lock ;
100101
@@ -117,7 +118,7 @@ struct btrfs_inode {
117118 * Counters to keep track of the number of extent item's we may use due
118119 * to delalloc and such. outstanding_extents is the number of extent
119120 * items we think we'll end up using, and reserved_extents is the number
120- * of extent items we've reserved metadata for.
121+ * of extent items we've reserved metadata for. Protected by 'lock'.
121122 */
122123 unsigned outstanding_extents ;
123124
@@ -143,28 +144,31 @@ struct btrfs_inode {
143144 u64 generation ;
144145
145146 /*
146- * transid of the trans_handle that last modified this inode
147+ * ID of the transaction handle that last modified this inode.
148+ * Protected by 'lock'.
147149 */
148150 u64 last_trans ;
149151
150152 /*
151- * transid that last logged this inode
153+ * ID of the transaction that last logged this inode.
154+ * Protected by 'lock'.
152155 */
153156 u64 logged_trans ;
154157
155158 /*
156- * log transid when this inode was last modified
159+ * Log transaction ID when this inode was last modified.
160+ * Protected by 'lock'.
157161 */
158162 int last_sub_trans ;
159163
160- /* a local copy of root's last_log_commit */
164+ /* A local copy of root's last_log_commit. Protected by 'lock'. */
161165 int last_log_commit ;
162166
163167 union {
164168 /*
165169 * Total number of bytes pending delalloc, used by stat to
166170 * calculate the real block usage of the file. This is used
167- * only for files.
171+ * only for files. Protected by 'lock'.
168172 */
169173 u64 delalloc_bytes ;
170174 /*
@@ -182,7 +186,7 @@ struct btrfs_inode {
182186 * Total number of bytes pending delalloc that fall within a file
183187 * range that is either a hole or beyond EOF (and no prealloc extent
184188 * exists in the range). This is always <= delalloc_bytes and this
185- * is used only for files.
189+ * is used only for files. Protected by 'lock'.
186190 */
187191 u64 new_delalloc_bytes ;
188192 /*
@@ -193,15 +197,15 @@ struct btrfs_inode {
193197 };
194198
195199 /*
196- * total number of bytes pending defrag, used by stat to check whether
197- * it needs COW.
200+ * Total number of bytes pending defrag, used by stat to check whether
201+ * it needs COW. Protected by 'lock'.
198202 */
199203 u64 defrag_bytes ;
200204
201205 /*
202- * the size of the file stored in the metadata on disk. data=ordered
206+ * The size of the file stored in the metadata on disk. data=ordered
203207 * means the in-memory i_size might be larger than the size on disk
204- * because not all the blocks are written yet.
208+ * because not all the blocks are written yet. Protected by 'lock'.
205209 */
206210 u64 disk_i_size ;
207211
@@ -235,7 +239,7 @@ struct btrfs_inode {
235239
236240 /*
237241 * Number of bytes outstanding that are going to need csums. This is
238- * used in ENOSPC accounting.
242+ * used in ENOSPC accounting. Protected by 'lock'.
239243 */
240244 u64 csum_bytes ;
241245
0 commit comments