[4324] in arla-drinkers

home help back first fref pref prev next nref lref last post

Re: arla on linux-2.6.24

daemon@ATHENA.MIT.EDU (Frej Drejhammar)
Sat Mar 8 10:35:33 2008

From arla-drinkers-bounces@stacken.kth.se Sat Mar 08 15:35:33 2008
Return-Path: <arla-drinkers-bounces@stacken.kth.se>
Delivered-To: arla-drinkers-mtg@bloom-picayune.mit.edu
Received: (qmail 4670 invoked from network); 8 Mar 2008 15:35:32 -0000
Received: from mx1.kth.se (130.237.32.140)
  by charon.mit.edu with SMTP; 8 Mar 2008 15:35:32 -0000
Received: from localhost (localhost [127.0.0.1])
	by mx1.kth.se (Postfix) with ESMTP id 70C0616C1A7;
	Sat,  8 Mar 2008 16:35:31 +0100 (CET)
X-Virus-Scanned: by amavisd-new at kth.se
Received: from mx1.kth.se ([127.0.0.1])
	by localhost (mx1.kth.se [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id YjpDPTz4GJ8F; Sat,  8 Mar 2008 16:35:29 +0100 (CET)
Received: from tapas.stacken.kth.se (tapas.stacken.kth.se [130.237.234.140])
	by mx1.kth.se (Postfix) with ESMTP id 0A3B916C03C;
	Sat,  8 Mar 2008 16:35:13 +0100 (CET)
Received: from tapas.stacken.kth.se (localhost [127.0.0.1])
	by tapas.stacken.kth.se (Postfix) with ESMTP id EEAB353502;
	Sat,  8 Mar 2008 16:35:12 +0100 (CET)
X-Original-To: arla-drinkers@tapas.stacken.kth.se
Delivered-To: arla-drinkers@tapas.stacken.kth.se
Received: from brev.stacken.kth.se (brev.stacken.kth.se [130.237.234.84])
	by tapas.stacken.kth.se (Postfix) with ESMTP id F1E3853502
	for <arla-drinkers@tapas.stacken.kth.se>;
	Sat,  8 Mar 2008 16:35:10 +0100 (CET)
Received: from mx2.kth.se (mx2.kth.se [130.237.48.98])
	by brev.stacken.kth.se (8.12.10/8.12.10) with ESMTP id m28FZATT022051
	for <arla-drinkers@stacken.kth.se>; Sat, 8 Mar 2008 16:35:10 +0100 (MET)
Received: from localhost (localhost [127.0.0.1])
	by mx2.kth.se (Postfix) with ESMTP id 555BE109E38
	for <arla-drinkers@stacken.kth.se>;
	Sat,  8 Mar 2008 16:35:05 +0100 (CET)
X-Virus-Scanned: by amavisd-new at kth.se
X-Spam-Flag: NO
X-Spam-Score: -3.099
X-Spam-Level: 
X-Spam-Status: No, score=-3.099 tagged_above=-200 required=5
	tests=[BAYES_00=-2.599, SPF_PASS=-0.5]
Received: from mx2.kth.se ([127.0.0.1])
	by localhost (mx2.kth.se [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id kk-ZsIF-CpvS for <arla-drinkers@stacken.kth.se>;
	Sat,  8 Mar 2008 16:35:02 +0100 (CET)
Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.188])
	by mx2.kth.se (Postfix) with ESMTP id B84A4109786
	for <arla-drinkers@stacken.kth.se>;
	Sat,  8 Mar 2008 16:35:02 +0100 (CET)
Received: by mu-out-0910.google.com with SMTP id w8so934432mue.1
	for <arla-drinkers@stacken.kth.se>;
	Sat, 08 Mar 2008 07:35:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:received:to:cc:subject:from:in-reply-to:references:date:message-id:user-agent:mime-version:content-type;
	bh=o1WcThQ6A0oiQ1zqiN600xDztniLpGrhJQ0NLOKybPA=;
	b=lmi7kcSGVJlovOV8AjnkwqpuldFX31Zst3roQ3omLCnDaABNXdO5RSGkq3c77GTxZ7GBUm1x5mFeizZ+KrWLCEW5KGOKTZstWBVuuegAjHahH5Vo4BfSPbSpNLq2W74KR2CJB/6ANzjALMXVaGgvyCNuRpWr0sYiuoGc6GqQUaA=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=to:cc:subject:from:in-reply-to:references:date:message-id:user-agent:mime-version:content-type;
	b=DdIaSDPetVK5l4/hPwqS+6dtz0OmB82KclVLdfgRuEK+1IAtPu7bZLvF+mF7z5FvzA64B99f1FbdSEB63RkQkYSZrt7wlSSvR+Ua4RfN03zYNpqLQn6IN0R6jM4NDXLh5Lq/n7EJX4Ri6w3YDrTLIlFwY3W1t+HWmgbeTgeeH5g=
Received: by 10.78.132.2 with SMTP id f2mr7621115hud.37.1204989003994;
	Sat, 08 Mar 2008 07:10:03 -0800 (PST)
Received: from fdsoft.dyndns.org ( [81.225.8.151])
	by mx.google.com with ESMTPS id b9sm7427769mug.12.2008.03.08.07.10.01
	(version=SSLv3 cipher=OTHER); Sat, 08 Mar 2008 07:10:02 -0800 (PST)
Received: from 192.168.1.7:43033 by emilia with ESMTP ;
	8 Mar 2008 16:10:00 +0100
To: Tomas Olsson <tol@stacken.kth.se>
Subject: Re: arla on linux-2.6.24
From: Frej Drejhammar <frej.drejhammar@gmail.com>
In-Reply-To: <1204471537.4180.30.camel@hippo.t.nxs.se> (Tomas Olsson's message
	of "Sun, 02 Mar 2008 16:25:37 +0100")
References: <1203286882.16414.3.camel@heterodyne.kaj>
	<20080218012608.V96329@fledge.watson.org>
	<20080222125207.GD38141@hamlet.setfilepointer.com>
	<20080223092516.O23969@fledge.watson.org>
	<20080223102922.GF38141@hamlet.setfilepointer.com>
	<20080223110549.GG38141@hamlet.setfilepointer.com>
	<20080223161249.GH38141@hamlet.setfilepointer.com>
	<90334B40754BEDC2991E0147@ganymede.hub.org>
	<p0624081bc3e936674ece@[128.113.24.47]>
	<20080226061140.GI28956@hamlet.SetFilePointer.com>
	<20080301210055.GA8919@hamlet.SetFilePointer.com>
	<47CABA31.7010707@free.fr> <1204471537.4180.30.camel@hippo.t.nxs.se>
Date: Sat, 08 Mar 2008 16:10:00 +0100
Message-ID: <kod9pntfb.fsf@liva.fdsoft.se>
User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Cc: arla-drinkers@stacken.kth.se
X-BeenThere: arla-drinkers@stacken.kth.se
X-Mailman-Version: 2.1.6
Precedence: list
List-Id: Arla discussions <arla-drinkers.stacken.kth.se>
List-Unsubscribe: <https://lists.stacken.kth.se/mailman/listinfo/arla-drinkers>, 
	<mailto:arla-drinkers-request@stacken.kth.se?subject=unsubscribe>
List-Archive: <http://lists.stacken.kth.se/pipermail/arla-drinkers>
List-Post: <mailto:arla-drinkers@stacken.kth.se>
List-Help: <mailto:arla-drinkers-request@stacken.kth.se?subject=help>
List-Subscribe: <https://lists.stacken.kth.se/mailman/listinfo/arla-drinkers>, 
	<mailto:arla-drinkers-request@stacken.kth.se?subject=subscribe>
Sender: arla-drinkers-bounces@stacken.kth.se
Errors-To: arla-drinkers-bounces@stacken.kth.se

--=-=-=

> On Sun, 2008-03-02 at 15:31 +0100, jeandamiendurand@free.fr wrote:
>> An /eventual /next release of arla might then address the module
>> compilation under linux-2.6.24 (path_walk symbol not exported
>> anymore as far as I remember, so the arla module fails to build).
> Ah, good to know. Let us know if you have any ideas on how to sort
> it out.

I have spent some time getting nnpfs to compile on linux >= 2.6.23
which unexports path_walk (use vfs_path_lookup instead), changes
struct vm_operations_struct (nopage is replaced by fault) and struct
file_operations (sendfile is replaced by splice_read). The attached
patch works for me but in is only tested on 2.6.24.2.

Regards,

--Frej


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
	filename=0001-Get-nnpfs-to-work-on-linux-2.6.23.patch

diff -u a/nnpfs/linux/nnpfs_blocks.c b/nnpfs/linux/nnpfs_blocks.c
--- a/nnpfs/linux/nnpfs_blocks.c
+++ b/nnpfs/linux/nnpfs_blocks.c
@@ -302,6 +302,23 @@ nnpfs_block_extend(struct nnpfs_node *node, uint64_t offset)
     return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
+/*
+ * Helper to emulate vfs_path_lookup() on linux < 2.6.23
+ */
+static int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
+			   const char *cachename, unsigned int flags,
+			   struct nameidata *nd)
+{
+    nd->dentry = dentry;
+    nd->mnt = mnt;
+    nd->last_type = LAST_NORM;
+    nd->depth = 0;
+    nd->flags = flags;
+    return path_walk(cachename, nd);
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) */
+
 /*
  * open indicated cache block file. needs to be closed by caller.
  *
@@ -351,16 +368,10 @@ nnpfs_block_open(struct nnpfs_node *node, uint64_t offset, int flag,
     current->fsuid = nnpfsp->uid;
     current->fsgid = nnpfsp->gid;
 
-    nd.dentry = dget(nnpfsp->cachedir);
-    nd.mnt = mntget(nnpfsp->cacheroot);
-    nd.last_type = LAST_NORM;
-    nd.depth = 0;
-    nd.flags = 0;
-    
-    if (flags & O_CREAT)
-	nd.flags = LOOKUP_PARENT;
-    
-    ret = path_walk(cachename, &nd);
+    ret = vfs_path_lookup(nnpfsp->cachedir,nnpfsp->cacheroot,
+			  cachename,
+			  flags & O_CREAT ? LOOKUP_PARENT : 0,
+			  &nd);
     if (ret) {
 	uint32_t nmasks = node->data.nmasks;
 	uint32_t mask;
diff -u a/nnpfs/linux/nnpfs_inodeops.c b/nnpfs/linux/nnpfs_inodeops.c
--- a/nnpfs/linux/nnpfs_inodeops.c
+++ b/nnpfs/linux/nnpfs_inodeops.c
@@ -105,7 +105,11 @@ nnpfs_vma_close (struct vm_area_struct *vma)
 }
 
 static struct vm_operations_struct nnpfs_file_vm_ops = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
     .nopage	= filemap_nopage,
+#else
+    .fault      = filemap_fault,
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) */
     .close	= nnpfs_vma_close,
 };
 
@@ -1545,6 +1549,7 @@ nnpfs_d_delete(struct dentry *dentry)
     return 0;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
 static ssize_t
 nnpfs_sendfile(struct file *file, loff_t *ppos, size_t count,
 	       read_actor_t actor, void *target)
@@ -1567,6 +1572,30 @@ nnpfs_sendfile(struct file *file, loff_t *ppos, size_t count,
     NNPFSDEB(XDEBVNOPS, ("nnpfs_sendfile: error = %d\n", error));
     return error;
 }
+#else
+static ssize_t
+nnpfs_splice_read(struct file *file, loff_t *ppos,
+		  struct pipe_inode_info *pipe, size_t count,
+		  unsigned int flags)
+{
+    int error = 0;
+    struct inode *inode = file->f_dentry->d_inode;
+    struct nnpfs_node *xn = VNODE_TO_XNODE(inode);
+    
+    if (xn != NULL)
+	NNPFSDEB(XDEBVNOPS, ("nnpfs_sendfile: tokens: 0x%x\n", xn->tokens));
+
+    error = nnpfs_data_valid(inode, NNPFS_DATA_R, *ppos, *ppos + count);
+    if (error) {
+	NNPFSDEB(XDEBVNOPS, ("nnpfs_sendfile: data not valid %d\n", error));
+	return error;
+    }
+    error = file->f_op->splice_read(file, ppos, pipe, count, flags);
+
+    NNPFSDEB(XDEBVNOPS, ("nnpfs_sendfile: error = %d\n", error));
+    return error;
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) */
 
 /*
  *
@@ -1924,7 +1953,11 @@ struct file_operations nnpfs_file_operations = {
     .flush	= nnpfs_flush,
     .release	= nnpfs_release_file,
     .fsync	= nnpfs_fsync,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
     .sendfile	= nnpfs_sendfile,
+#else
+    .splice_read = nnpfs_splice_read,
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) */
 };
 
 struct file_operations nnpfs_dead_operations = {

--=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Arla-drinkers mailing list
Arla-drinkers@stacken.kth.se
https://lists.stacken.kth.se/mailman/listinfo/arla-drinkers

--=-=-=--

home help back first fref pref prev next nref lref last post