FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 07-26-2012, 01:42 PM
Steven Whitehouse
 
Default GFS2: Make write size hinting code common

>From c798798bb81ca1eb0b2680545740475984290dcb Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <swhiteho@redhat.com>
Date: Thu, 26 Jul 2012 11:30:54 +0100
Subject: GFS2: Make write size hinting code common

This collects up the write size hinting code which is used by the
block reservation subsystem into a single function. At the same
time this also corrects the rounding for this calculation.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 9aa6af1..d1e6d9b 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -323,6 +323,29 @@ static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
}

/**
+ * gfs2_size_hint - Give a hint to the size of a write request
+ * @file: The struct file
+ * @offset: The file offset of the write
+ * @size: The length of the write
+ *
+ * When we are about to do a write, this function records the total
+ * write size in order to provide a suitable hint to the lower layers
+ * about how many blocks will be required.
+ *
+ */
+
+static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size)
+{
+ struct inode *inode = filep->f_dentry->d_inode;
+ struct gfs2_sbd *sdp = GFS2_SB(inode);
+ struct gfs2_inode *ip = GFS2_I(inode);
+ size_t blks = (size + sdp->sd_sb.sb_bsize - 1) >> sdp->sd_sb.sb_bsize_shift;
+ int hint = min_t(size_t, INT_MAX, blks);
+
+ atomic_set(&ip->i_res->rs_sizehint, hint);
+}
+
+/**
* gfs2_allocate_page_backing - Use bmap to allocate blocks
* @page: The (locked) page to allocate backing for
*
@@ -383,8 +406,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
if (ret)
return ret;

- atomic_set(&ip->i_res->rs_sizehint,
- PAGE_CACHE_SIZE >> sdp->sd_sb.sb_bsize_shift);
+ gfs2_size_hint(vma->vm_file, pos, PAGE_CACHE_SIZE);

gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
ret = gfs2_glock_nq(&gh);
@@ -669,7 +691,8 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
if (ret)
return ret;

- atomic_set(&ip->i_res->rs_sizehint, writesize >> sdp->sd_sb.sb_bsize_shift);
+ gfs2_size_hint(file, pos, writesize);
+
if (file->f_flags & O_APPEND) {
struct gfs2_holder gh;

@@ -795,7 +818,7 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
if (unlikely(error))
goto out_uninit;

- atomic_set(&ip->i_res->rs_sizehint, len >> sdp->sd_sb.sb_bsize_shift);
+ gfs2_size_hint(file, offset, len);

while (len > 0) {
if (len < bytes)
--
1.7.4




Thu Jul 26 16:30:01 2012
Return-Path: <gentoo-user+bounces-140171-tom=linux-archive.org@lists.gentoo.org>
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
eagle542.startdedicated.com
X-Spam-Level:
X-Spam-Status: No, score=-4.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,FREEMAIL_FROM,FSL_RCVD_USER,RCVD_IN_ DNSWL_HI,RCVD_IN_SORBS_WEB,
SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-Original-To: tom@linux-archive.org
Delivered-To: tom-linux-archive.org@eagle542.startdedicated.com
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
by eagle542.startdedicated.com (Postfix) with ESMTP id 8AB4520E0047
for <tom@linux-archive.org>; Thu, 26 Jul 2012 15:46:56 +0200 (CEST)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
by pigeon.gentoo.org (Postfix) with SMTP id 5DD77E07DD;
Thu, 26 Jul 2012 13:46:42 +0000 (UTC)
X-Original-To: gentoo-user@lists.gentoo.org
Delivered-To: gentoo-user@lists.gentoo.org
Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181])
by pigeon.gentoo.org (Postfix) with ESMTP id 1B8C7E0458
for <gentoo-user@lists.gentoo.org>; Thu, 26 Jul 2012 13:42:51 +0000 (UTC)
Received: by lbbgk8 with SMTP id gk8so1451034lbb.40
for <gentoo-user@lists.gentoo.org>; Thu, 26 Jul 2012 06:42:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=message-id:date:from:user-agent:mime-version:to:subject:references
:in-reply-to:content-type:content-transfer-encoding;
bh=2LKJVxZDaIBVDweGb/UdJ8p/8TT48eHb1dQ/Jk9hUDU=;
b=K8MRz0amHpA34yIb7LCtzT/maBqihmWkfhT8wRRpumQ0lhLYR04p1zKo1a5/wAmfEm
wgfcvXm19zXrlhGEwOE0783WjL2p3O4NfUCziLoADyzuwAAlht +5tCI4Rt9CmtEmh2PK
Wj1SNpQKvwSTfrIFo+ya0711NYAKutBkWrtuq5VLktd1wGclnR Ngcc1wedj6SgZASgk2
7YRrLDgeft/iN1iQD7VNtU35/vLBiCP18q2/SIrx5jalEjO6RrJoMZgiVpd2e/mng2n+
odpBuNGwSm2honj9aJzhmrCjzFHkxGQejNCLcA4zLqnuRLILFu NOeEF2cHoY70iR0IRU
MKtA==
Received: by 10.112.49.68 with SMTP id s4mr13551786lbn.27.1343310170996;
Thu, 26 Jul 2012 06:42:50 -0700 (PDT)
Received: from [10.1.1.201] ([87.251.152.251])
by mx.google.com with ESMTPS id u10sm5208784lbm.14.2012.07.26.06.42.49
(version=SSLv3 cipher=OTHER);
Thu, 26 Jul 2012 06:42:50 -0700 (PDT)
Message-ID: <50114977.9000001@gmail.com>
Date: Thu, 26 Jul 2012 17:43:19 +0400
From: =?UTF-8?B?0JXQstCz0LXQvdC40Lkg0J/QtdGA0LzRj9C60L7Qsg==?=
<permeakra@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@lists.gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
MIME-Version: 1.0
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] new machine : CPU : 22 nm vs 32 nm
References: <20120725200529.GF2965@ca.inter.net>
In-Reply-To: <20120725200529.GF2965@ca.inter.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 07/26/2012 12:05 AM, Philip Webb wrote:
> I've listed what's available at the local store,
> which I trust to stock reliable items, tho' I wouldn't ask their advice.
>
> All the AMD's are 32 nm , while the Intel recommended by one commenter
> -- Core i5-3570 4-Core Socket LGA1155, 3.4 Ghz, 6MB L3 Cache, 22 nm --
> is 22 nm : it costs CAD 230 & they have 3 in stock,
> which suggests demand, but not the most popular ( 9 in stock).
>
> Isn't 22 nm going to be faster than 32 nm ?
>
> In the same price range, AMD offers Bulldozer X8 FX-8150 (125W)
> 8-Core Socket AM3+, 3.6 GHz, 8Mb Cache, 32 nm ( CAD 220 , 2 in stock).
>
> How do you compare cores vs nm ?
> How far is cache size important ( 6 vs 8 MB )?
>
> When I built my current machine 2007, the CPU cost CAD 213 ,
> so both look as if they're in the right ballpark.
>
If you're building new, performance-oriented box, you should take latest
intel with AVX because of AVX. As I recall, recent gcc has support for
avx, so some performance gain may be achieved.
If you want home box, you may be interested in AMD A8 and similar chips,
as they are reasonably fast and very chip

In any case, I'd put most of my money in 2-4 big 3Tb HDD's for media and
8+ Gb fast memory, as modern browsers eat memory like crazies and CPU is
usually fast enough. Decoding HDTV mkv's should occur on gpu block in
any case, so general performance for most uses is irrelevant, as it was
fast enough four yesrs earlier. Simply check, that you can offload HDTV
decoding to GPU in your config.
 

Thread Tools




All times are GMT. The time now is 08:35 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org