linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: Adrian Hunter <adrian.hunter@linux.intel.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: don't commit the transaction if we dont have enough pinned bytes V2
Date: Thu, 26 May 2011 09:25:57 -0400	[thread overview]
Message-ID: <4DDE54E5.3020606@redhat.com> (raw)
In-Reply-To: <4DDE160A.9060803@linux.intel.com>

On 05/26/2011 04:57 AM, Adrian Hunter wrote:
> On 25/05/11 22:30, Josef Bacik wrote:
>> I noticed when running an enospc test that we would get stuck
>> committing the
>> transaction in check_data_space even though we truly didn't have
>> enough space.
>> So check to see if bytes_pinned is bigger than num_bytes, if it's not
>> don't
>> commit the transaction.  Thanks,
>>
>> Signed-off-by: Josef Bacik<josef@redhat.com>
>> ---
>> V1->V2: Make it so it actually compiles ;)
>>   fs/btrfs/extent-tree.c |    7 +++++++
>>   1 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
>> index c8c3184..b4f67e8 100644
>> --- a/fs/btrfs/extent-tree.c
>> +++ b/fs/btrfs/extent-tree.c
>> @@ -3199,6 +3199,13 @@ alloc:
>>               }
>>               goto again;
>>           }
>> +
>> +        /*
>> +         * If we have less pinned bytes than we want to allocate then
>> +         * don't bother committing the transaction, it won't help us.
>> +         */
>> +        if (data_sinfo->bytes_pinned<  bytes)
>> +            committed = 1;
>>           spin_unlock(&data_sinfo->lock);
>>
>>           /* commit the current transaction and try again */
> 
> I tried that patch on 2.6.39 with the following:
> 
> sudo modprobe brd rd_size=262144
> sudo mkfs.btrfs /dev/ram0
> sudo mkdir -p /mnt/test
> sudo mount -t btrfs /dev/ram0 /mnt/test
> sudo mkdir -p /mnt/test/test
> sudo chown $USER /mnt/test/test
> sudo chgrp $USER /mnt/test/test
> sudo umount /mnt/test
> i=0
> while true; do
>     sudo mount -t btrfs /dev/ram0 /mnt/test
>     fsstress -c -r -d /mnt/test/test -p 3 -n 1000 -l 10
>     sudo umount /mnt/test
>     i=`expr $i \+ 1`
>     echo $i
> done
> 
> 
> After 3 iterations it got really slow and then after some minutes it
> still seems to lock up:
> 

Did you run without my patch?  I assume this will still happen even
without my patch.  The only possible negative side-effect of my patch is
we could ENOSPC early.  Thanks,

Josef

      reply	other threads:[~2011-05-26 13:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 17:11 [PATCH] Btrfs: don't commit the transaction if we dont have enough pinned bytes Josef Bacik
2011-05-25 19:30 ` [PATCH] Btrfs: don't commit the transaction if we dont have enough pinned bytes V2 Josef Bacik
2011-05-26  8:57   ` Adrian Hunter
2011-05-26 13:25     ` Josef Bacik [this message]

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=4DDE54E5.3020606@redhat.com \
    --to=josef@redhat.com \
    --cc=adrian.hunter@linux.intel.com \
    --cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).