diff options
author | Jeff Mahoney <jeffm@suse.com> | 2014-04-23 10:00:36 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2014-05-06 22:52:19 +0200 |
commit | 098297b27d23ad9d0fc302e3417474d9342c6c14 (patch) | |
tree | 58f2054cd9933225ef1ae9c7febedc9160041af6 /fs/reiserfs/tail_conversion.c | |
parent | 4cf5f7addf18ecae2ea49b11944976cbd26d5281 (diff) |
reiserfs: cleanup, reformat comments to normal kernel style
This patch reformats comments in the reiserfs code to fit in 80 columns and
to follow the style rules.
There is no functional change but it helps make my eyes bleed less.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/reiserfs/tail_conversion.c')
-rw-r--r-- | fs/reiserfs/tail_conversion.c | 151 |
1 files changed, 94 insertions, 57 deletions
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c index fc1981d858d..f41e19b4bb4 100644 --- a/fs/reiserfs/tail_conversion.c +++ b/fs/reiserfs/tail_conversion.c @@ -1,5 +1,6 @@ /* - * Copyright 1999 Hans Reiser, see reiserfs/README for licensing and copyright details + * Copyright 1999 Hans Reiser, see reiserfs/README for licensing and copyright + * details */ #include <linux/time.h> @@ -7,13 +8,19 @@ #include <linux/buffer_head.h> #include "reiserfs.h" -/* access to tail : when one is going to read tail it must make sure, that is not running. - direct2indirect and indirect2direct can not run concurrently */ +/* + * access to tail : when one is going to read tail it must make sure, that is + * not running. direct2indirect and indirect2direct can not run concurrently + */ -/* Converts direct items to an unformatted node. Panics if file has no - tail. -ENOSPC if no disk space for conversion */ -/* path points to first direct item of the file regarless of how many of - them are there */ +/* + * Converts direct items to an unformatted node. Panics if file has no + * tail. -ENOSPC if no disk space for conversion + */ +/* + * path points to first direct item of the file regardless of how many of + * them are there + */ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode, struct treepath *path, struct buffer_head *unbh, loff_t tail_offset) @@ -22,14 +29,20 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode, struct buffer_head *up_to_date_bh; struct item_head *p_le_ih = tp_item_head(path); unsigned long total_tail = 0; - struct cpu_key end_key; /* Key to search for the last byte of the - converted item. */ - struct item_head ind_ih; /* new indirect item to be inserted or - key of unfm pointer to be pasted */ - int blk_size, retval; /* returned value for reiserfs_insert_item and clones */ - unp_t unfm_ptr; /* Handle on an unformatted node - that will be inserted in the - tree. */ + + /* Key to search for the last byte of the converted item. */ + struct cpu_key end_key; + + /* + * new indirect item to be inserted or key + * of unfm pointer to be pasted + */ + struct item_head ind_ih; + int blk_size; + /* returned value for reiserfs_insert_item and clones */ + int retval; + /* Handle on an unformatted node that will be inserted in the tree. */ + unp_t unfm_ptr; BUG_ON(!th->t_trans_id); @@ -37,8 +50,10 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode, blk_size = sb->s_blocksize; - /* and key to search for append or insert pointer to the new - unformatted node. */ + /* + * and key to search for append or insert pointer to the new + * unformatted node. + */ copy_item_head(&ind_ih, p_le_ih); set_le_ih_k_offset(&ind_ih, tail_offset); set_le_ih_k_type(&ind_ih, TYPE_INDIRECT); @@ -76,20 +91,26 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode, if (retval) { return retval; } - // note: from here there are two keys which have matching first - // three key components. They only differ by the fourth one. + /* + * note: from here there are two keys which have matching first + * three key components. They only differ by the fourth one. + */ /* Set the key to search for the direct items of the file */ make_cpu_key(&end_key, inode, max_reiserfs_offset(inode), TYPE_DIRECT, 4); - /* Move bytes from the direct items to the new unformatted node - and delete them. */ + /* + * Move bytes from the direct items to the new unformatted node + * and delete them. + */ while (1) { int tail_size; - /* end_key.k_offset is set so, that we will always have found - last item of the file */ + /* + * end_key.k_offset is set so, that we will always have found + * last item of the file + */ if (search_for_position_by_key(sb, &end_key, path) == POSITION_FOUND) reiserfs_panic(sb, "PAP-14050", @@ -101,11 +122,12 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode, tail_size = (le_ih_k_offset(p_le_ih) & (blk_size - 1)) + ih_item_len(p_le_ih) - 1; - /* we only send the unbh pointer if the buffer is not up to date. - ** this avoids overwriting good data from writepage() with old data - ** from the disk or buffer cache - ** Special case: unbh->b_page will be NULL if we are coming through - ** DIRECT_IO handler here. + /* + * we only send the unbh pointer if the buffer is not + * up to date. this avoids overwriting good data from + * writepage() with old data from the disk or buffer cache + * Special case: unbh->b_page will be NULL if we are coming + * through DIRECT_IO handler here. */ if (!unbh->b_page || buffer_uptodate(unbh) || PageUptodate(unbh->b_page)) { @@ -117,13 +139,15 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode, up_to_date_bh); total_tail += retval; + + /* done: file does not have direct items anymore */ if (tail_size == retval) - // done: file does not have direct items anymore break; } - /* if we've copied bytes from disk into the page, we need to zero - ** out the unused part of the block (it was not up to date before) + /* + * if we've copied bytes from disk into the page, we need to zero + * out the unused part of the block (it was not up to date before) */ if (up_to_date_bh) { unsigned pgoff = @@ -146,9 +170,11 @@ void reiserfs_unmap_buffer(struct buffer_head *bh) BUG(); } clear_buffer_dirty(bh); - /* Remove the buffer from whatever list it belongs to. We are mostly - interested in removing it from per-sb j_dirty_buffers list, to avoid - BUG() on attempt to write not mapped buffer */ + /* + * Remove the buffer from whatever list it belongs to. We are mostly + * interested in removing it from per-sb j_dirty_buffers list, to avoid + * BUG() on attempt to write not mapped buffer + */ if ((!list_empty(&bh->b_assoc_buffers) || bh->b_private) && bh->b_page) { struct inode *inode = bh->b_page->mapping->host; struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb); @@ -164,12 +190,14 @@ void reiserfs_unmap_buffer(struct buffer_head *bh) unlock_buffer(bh); } -/* this first locks inode (neither reads nor sync are permitted), - reads tail through page cache, insert direct item. When direct item - inserted successfully inode is left locked. Return value is always - what we expect from it (number of cut bytes). But when tail remains - in the unformatted node, we set mode to SKIP_BALANCING and unlock - inode */ +/* + * this first locks inode (neither reads nor sync are permitted), + * reads tail through page cache, insert direct item. When direct item + * inserted successfully inode is left locked. Return value is always + * what we expect from it (number of cut bytes). But when tail remains + * in the unformatted node, we set mode to SKIP_BALANCING and unlock + * inode + */ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *inode, struct page *page, struct treepath *path, /* path to the indirect item. */ @@ -207,9 +235,11 @@ int indirect2direct(struct reiserfs_transaction_handle *th, 1) * sb->s_blocksize; pos1 = pos; - // we are protected by i_mutex. The tail can not disapper, not - // append can be done either - // we are in truncate or packing tail in file_release + /* + * we are protected by i_mutex. The tail can not disapper, not + * append can be done either + * we are in truncate or packing tail in file_release + */ tail = (char *)kmap(page); /* this can schedule */ @@ -236,9 +266,10 @@ int indirect2direct(struct reiserfs_transaction_handle *th, pos1 + 1, TYPE_DIRECT, round_tail_len, 0xffff /*ih_free_space */ ); - /* we want a pointer to the first byte of the tail in the page. - ** the page was locked and this part of the page was up to date when - ** indirect2direct was called, so we know the bytes are still valid + /* + * we want a pointer to the first byte of the tail in the page. + * the page was locked and this part of the page was up to date when + * indirect2direct was called, so we know the bytes are still valid */ tail = tail + (pos & (PAGE_CACHE_SIZE - 1)); @@ -250,12 +281,14 @@ int indirect2direct(struct reiserfs_transaction_handle *th, /* Insert tail as new direct item in the tree */ if (reiserfs_insert_item(th, path, &key, &s_ih, inode, tail ? tail : NULL) < 0) { - /* No disk memory. So we can not convert last unformatted node - to the direct item. In this case we used to adjust - indirect items's ih_free_space. Now ih_free_space is not - used, it would be ideal to write zeros to corresponding - unformatted node. For now i_size is considered as guard for - going out of file size */ + /* + * No disk memory. So we can not convert last unformatted node + * to the direct item. In this case we used to adjust + * indirect items's ih_free_space. Now ih_free_space is not + * used, it would be ideal to write zeros to corresponding + * unformatted node. For now i_size is considered as guard for + * going out of file size + */ kunmap(page); return block_size - round_tail_len; } @@ -264,12 +297,16 @@ int indirect2direct(struct reiserfs_transaction_handle *th, /* make sure to get the i_blocks changes from reiserfs_insert_item */ reiserfs_update_sd(th, inode); - // note: we have now the same as in above direct2indirect - // conversion: there are two keys which have matching first three - // key components. They only differ by the fouhth one. + /* + * note: we have now the same as in above direct2indirect + * conversion: there are two keys which have matching first three + * key components. They only differ by the fourth one. + */ - /* We have inserted new direct item and must remove last - unformatted node. */ + /* + * We have inserted new direct item and must remove last + * unformatted node. + */ *mode = M_CUT; /* we store position of first direct item in the in-core inode */ |