From: Evgeniy Dushistov <dushistov@mail.ru>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/5]: ufs: missed brelse and wrong baseblk
Date: Sat, 17 Jun 2006 14:14:04 +0400 [thread overview]
Message-ID: <20060617101403.GA22098@rain.homenetwork> (raw)
This patch fixes two bugs, which introduced by previous
patches:
1)Missed "brelse"
2)Sometimes "baseblk" may be wrongly calculated, if
i_size is equal to zero, which lead infinite cycle
in "mpage_writepages".
Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
---
Index: linux-2.6.17-rc6-mm2/fs/ufs/inode.c
===================================================================
--- linux-2.6.17-rc6-mm2.orig/fs/ufs/inode.c
+++ linux-2.6.17-rc6-mm2/fs/ufs/inode.c
@@ -175,6 +175,7 @@ ufs_clear_frags(struct inode *inode, sec
for (++beg; beg < end; ++beg) {
bh = sb_getblk(inode->i_sb, beg);
ufs_clear_frag(inode, bh);
+ brelse(bh);
}
return res;
}
Index: linux-2.6.17-rc6-mm2/fs/ufs/balloc.c
===================================================================
--- linux-2.6.17-rc6-mm2.orig/fs/ufs/balloc.c
+++ linux-2.6.17-rc6-mm2/fs/ufs/balloc.c
@@ -269,20 +269,17 @@ out:
* We can come here from ufs_writepage or ufs_prepare_write,
* locked_page is argument of these functions, so we already lock it.
*/
-static void ufs_change_blocknr(struct inode *inode, unsigned int count,
- unsigned int oldb, unsigned int newb,
- struct page *locked_page)
+static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk,
+ unsigned int count, unsigned int oldb,
+ unsigned int newb, struct page *locked_page)
{
unsigned int blk_per_page = 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits);
- sector_t baseblk;
struct address_space *mapping = inode->i_mapping;
pgoff_t index, cur_index = locked_page->index;
unsigned int i, j;
struct page *page;
struct buffer_head *head, *bh;
- baseblk = ((i_size_read(inode) - 1) >> inode->i_blkbits) + 1 - count;
-
UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n",
inode->i_ino, count, oldb, newb);
@@ -439,7 +436,8 @@ unsigned ufs_new_fragments(struct inode
}
result = ufs_alloc_fragments (inode, cgno, goal, request, err);
if (result) {
- ufs_change_blocknr(inode, oldcount, tmp, result, locked_page);
+ ufs_change_blocknr(inode, fragment - oldcount, oldcount, tmp,
+ result, locked_page);
*p = cpu_to_fs32(sb, result);
*err = 0;
--
/Evgeniy
next reply other threads:[~2006-06-17 10:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-17 10:14 Evgeniy Dushistov [this message]
2006-06-18 16:20 ` [PATCH 1/5]: ufs: missed brelse and wrong baseblk Al Viro
2006-06-18 17:50 ` Al Viro
2006-06-19 6:47 ` Evgeniy Dushistov
2006-06-19 7:32 ` Al Viro
2006-06-19 13:17 ` Evgeniy Dushistov
2006-06-19 18:28 ` Al Viro
2006-06-19 18:58 ` Evgeniy Dushistov
2006-06-19 19:13 ` Al Viro
2006-06-20 16:30 ` Evgeniy Dushistov
2006-06-20 16:30 ` Evgeniy Dushistov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060617101403.GA22098@rain.homenetwork \
--to=dushistov@mail.ru \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.