mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Badari Pulavarty <pbadari@us.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.6.11-mm1 "nobh" support for ext3 writeback mode
Date: Fri, 4 Mar 2005 16:23:31 -0800	[thread overview]
Message-ID: <20050304162331.4a7dfdb8.akpm@osdl.org> (raw)
In-Reply-To: <1109980952.7236.39.camel@dyn318077bld.beaverton.ibm.com>

Badari Pulavarty <pbadari@us.ibm.com> wrote:
>
> @@ -1646,13 +1659,34 @@ static int ext3_block_truncate_page(hand
>  	unsigned blocksize, iblock, length, pos;
>  	struct inode *inode = mapping->host;
>  	struct buffer_head *bh;
> -	int err;
> +	int err = 0;
>  	void *kaddr;
>  
>  	blocksize = inode->i_sb->s_blocksize;
>  	length = blocksize - (offset & (blocksize - 1));
>  	iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
>  
> +	if (test_opt(inode->i_sb, NOBH) && !page_has_buffers(page)) {
> +		if (!PageUptodate(page)) {
> +			err = mpage_readpage(page, ext3_get_block);
> +			if ((err == 0) && !PageUptodate(page))
> +				wait_on_page_locked(page);
> +			lock_page(page);
> +		}
> +		if (err == 0 && PageUptodate(page)) {
> +			kaddr = kmap_atomic(page, KM_USER0);
> +			memset(kaddr + offset, 0, length);
> +			flush_dcache_page(page);
> +			kunmap_atomic(kaddr, KM_USER0);
> +			set_page_dirty(page);
> +			goto unlock;
> +		}
> +		/* 

What's all this doing?  (It needs comments please - it's very unobvious).

Dropping and reacquiring the page lock in the middle of the truncate there
is a bit of a worry - need to think about that.

Err, yes, it's buggy - page reclaim can come in, grab the page lock and
whip the page off the mapping.  We end up with an anonymous page and we
then start trying to write it into the file and all sorts of things.


This bit:

			if ((err == 0) && !PageUptodate(page))
				wait_on_page_locked(page);

can simply be removed.  We're about to lock the page anyway.

  reply	other threads:[~2005-03-05  0:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-05  0:02 Badari Pulavarty
2005-03-05  0:23 ` Andrew Morton [this message]
2005-03-05  0:29   ` Badari Pulavarty
2005-03-05  0:45     ` Andrew Morton
2005-03-05  0:49       ` Badari Pulavarty
2005-03-05  1:02       ` Badari Pulavarty
2005-03-05  1:16         ` Andrew Morton
2005-03-05 17:39           ` Badari Pulavarty
2005-03-05  0:31   ` Andrew Morton
2005-03-05  0:46     ` Badari Pulavarty

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=20050304162331.4a7dfdb8.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbadari@us.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®