| 1 | /* |
|---|
| 2 | * linux/include/linux/ext3_jbd.h |
|---|
| 3 | * |
|---|
| 4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 |
|---|
| 5 | * |
|---|
| 6 | * Copyright 1998--1999 Red Hat corp --- All Rights Reserved |
|---|
| 7 | * |
|---|
| 8 | * This file is part of the Linux kernel and is made available under |
|---|
| 9 | * the terms of the GNU General Public License, version 2, or at your |
|---|
| 10 | * option, any later version, incorporated herein by reference. |
|---|
| 11 | * |
|---|
| 12 | * Ext3-specific journaling extensions. |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | #ifndef _LINUX_EXT3_JBD_H |
|---|
| 16 | #define _LINUX_EXT3_JBD_H |
|---|
| 17 | |
|---|
| 18 | #include <linux/fs.h> |
|---|
| 19 | #include <linux/jbd.h> |
|---|
| 20 | #include <linux/ext3_fs.h> |
|---|
| 21 | |
|---|
| 22 | #define EXT3_JOURNAL(inode) (EXT3_SB((inode)->i_sb)->s_journal) |
|---|
| 23 | |
|---|
| 24 | /* Define the number of blocks we need to account to a transaction to |
|---|
| 25 | * modify one block of data. |
|---|
| 26 | * |
|---|
| 27 | * We may have to touch one inode, one bitmap buffer, up to three |
|---|
| 28 | * indirection blocks, the group and superblock summaries, and the data |
|---|
| 29 | * block to complete the transaction. */ |
|---|
| 30 | |
|---|
| 31 | #define EXT3_SINGLEDATA_TRANS_BLOCKS 8U |
|---|
| 32 | |
|---|
| 33 | /* Extended attribute operations touch at most two data buffers, |
|---|
| 34 | * two bitmap buffers, and two group summaries, in addition to the inode |
|---|
| 35 | * and the superblock, which are already accounted for. */ |
|---|
| 36 | |
|---|
| 37 | #define EXT3_XATTR_TRANS_BLOCKS 6U |
|---|
| 38 | |
|---|
| 39 | /* Define the minimum size for a transaction which modifies data. This |
|---|
| 40 | * needs to take into account the fact that we may end up modifying two |
|---|
| 41 | * quota files too (one for the group, one for the user quota). The |
|---|
| 42 | * superblock only gets updated once, of course, so don't bother |
|---|
| 43 | * counting that again for the quota updates. */ |
|---|
| 44 | |
|---|
| 45 | #define EXT3_DATA_TRANS_BLOCKS (EXT3_SINGLEDATA_TRANS_BLOCKS + \ |
|---|
| 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ |
|---|
| 47 | 2*EXT3_QUOTA_TRANS_BLOCKS) |
|---|
| 48 | |
|---|
| 49 | /* Delete operations potentially hit one directory's namespace plus an |
|---|
| 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be |
|---|
| 51 | * generous. We can grow the delete transaction later if necessary. */ |
|---|
| 52 | |
|---|
| 53 | #define EXT3_DELETE_TRANS_BLOCKS (2 * EXT3_DATA_TRANS_BLOCKS + 64) |
|---|
| 54 | |
|---|
| 55 | /* Define an arbitrary limit for the amount of data we will anticipate |
|---|
| 56 | * writing to any given transaction. For unbounded transactions such as |
|---|
| 57 | * write(2) and truncate(2) we can write more than this, but we always |
|---|
| 58 | * start off at the maximum transaction size and grow the transaction |
|---|
| 59 | * optimistically as we go. */ |
|---|
| 60 | |
|---|
| 61 | #define EXT3_MAX_TRANS_DATA 64U |
|---|
| 62 | |
|---|
| 63 | /* We break up a large truncate or write transaction once the handle's |
|---|
| 64 | * buffer credits gets this low, we need either to extend the |
|---|
| 65 | * transaction or to start a new one. Reserve enough space here for |
|---|
| 66 | * inode, bitmap, superblock, group and indirection updates for at least |
|---|
| 67 | * one block, plus two quota updates. Quota allocations are not |
|---|
| 68 | * needed. */ |
|---|
| 69 | |
|---|
| 70 | #define EXT3_RESERVE_TRANS_BLOCKS 12U |
|---|
| 71 | |
|---|
| 72 | #define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8 |
|---|
| 73 | |
|---|
| 74 | #endif /* _LINUX_EXT3_JBD_H */ |
|---|