Skip to contentSkip to conversation

LAYOUTGET invocation cleanup patches

PATCH In review Fred Isaman 3 participants 12 messages Jun 11, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover LAYOUTGET invocation cleanup patches

These patches, applied to the head of pnfs-all-latest after rebase, bring the blocklayout back in synch with the generic code changed by my previous patches and the rebase. The final tree containing the fully rebased tree with these patches applied is at
git://linux-nfs.org/~isaman/pnfs-block.git in the branch for-benny-20100611.

Fred

#1 lore raw

PATCH 1/7 SQUASHME: pnfs: export get_lseg and put_lseg

---
 fs/nfs/pnfs.c             |    8 ++++++++
 fs/nfs/pnfs.h             |    6 ------
 include/linux/nfs4_pnfs.h |    3 +++
 3 files changed, 11 insertions(+), 6 deletions(-)
fs/nfs/pnfs.c +8 -0
index ab47308..d6ba358 100644
@@ -454,6 +454,14 @@ put_lseg(struct pnfs_layout_segment *lseg)
 		wake_up(&nfsi->lo_waitq);
 }
 
+EXPORT_SYMBOL(put_lseg);
+
+void get_lseg(struct pnfs_layout_segment *lseg)
+{
+	kref_get(&lseg->kref);
+}
+EXPORT_SYMBOL(get_lseg);
+
 static inline u64
 end_offset(u64 start, u64 len)
 {
fs/nfs/pnfs.h +0 -6
index 810ce9e..fd7c532 100644
@@ -34,7 +34,6 @@ extern int pnfs4_proc_layoutreturn(struct nfs4_pnfs_layoutreturn *lrp, bool wait
 /* pnfs.c */
 extern const nfs4_stateid zero_stateid;
 
-void put_lseg(struct pnfs_layout_segment *lseg);
 void _pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
 	loff_t pos, u64 count, enum pnfs_iomode access_type,
 	struct pnfs_layout_segment **lsegpp);
@@ -95,11 +94,6 @@ static inline int lo_fail_bit(u32 iomode)
 			 NFS_INO_RW_LAYOUT_FAILED : NFS_INO_RO_LAYOUT_FAILED;
 }
 
-static inline void get_lseg(struct pnfs_layout_segment *lseg)
-{
-	kref_get(&lseg->kref);
-}
-
 /* Return true if a layout driver is being used for this mountpoint */
 static inline int pnfs_enabled_sb(struct nfs_server *nfss)
 {
include/linux/nfs4_pnfs.h +3 -0
index 744ca33..b7772c8 100644
@@ -92,6 +92,9 @@ layoutcommit_needed(struct nfs_inode *nfsi)
 	return nfsi->layout.lo_cred != NULL;
 }
 
+extern void put_lseg(struct pnfs_layout_segment *lseg);
+extern void get_lseg(struct pnfs_layout_segment *lseg);
+
 #else /* CONFIG_NFS_V4_1 */
 
 static inline bool
Signature · 1 line
1.6.6.1
#2 lore raw

PATCH 2/7 SQUASHME: pnfsblock: write_begin adjust for removed fields

ok_to_use_pnfs and PG_USE_PNFS are gone, instead test req->wb_lseg for NULL. This also means that the entire do_flush routine is redundant.

---
 fs/nfs/blocklayout/blocklayout.c |   21 ++++-----------------
 1 files changed, 4 insertions(+), 17 deletions(-)
fs/nfs/blocklayout/blocklayout.c +4 -17
index 66044d4..eb5760f 100644
@@ -988,10 +988,10 @@ bl_write_begin(struct pnfs_layout_segment *lseg, struct page *page, loff_t pos,
 	if (bl->bl_blocksize < (PAGE_CACHE_SIZE >> 9)) {
 		dprintk("%s Can't handle blocksize %llu\n", __func__,
 			(u64)bl->bl_blocksize);
-		fsdata->ok_to_use_pnfs = 0;
+		put_lseg(fsdata->lseg);
+		fsdata->lseg = NULL;
 		return 0;
 	}
-	fsdata->ok_to_use_pnfs = 1;
 	if (PageMappedToDisk(page)) {
 		/* Basically, this is a flag that says we have
 		 * successfully called write_begin already on this page.
@@ -1014,7 +1014,8 @@ bl_write_begin(struct pnfs_layout_segment *lseg, struct page *page, loff_t pos,
 		 * should be true if we get here.
 		 */
 		BUG_ON(PagePrivate(page));
-		fsdata->ok_to_use_pnfs = 0;
+		put_lseg(fsdata->lseg);
+		fsdata->lseg = NULL;
 		kfree(pages_to_mark);
 		ret = 0;
 	} else {
@@ -1122,19 +1123,6 @@ bl_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
 	}
 }
 
-/* This checks if old req will likely use same io method as soon
- * to be created request, and returns False if they are the same.
- */
-static int
-bl_do_flush(struct pnfs_layout_segment *lseg, struct nfs_page *req,
-	    struct pnfs_fsdata *fsdata)
-{
-	int will_try_pnfs;
-	dprintk("%s enter\n", __func__);
-	will_try_pnfs = fsdata ? (fsdata->ok_to_use_pnfs) : (lseg != NULL);
-	return will_try_pnfs != test_bit(PG_USE_PNFS, &req->wb_flags);
-}
-
 static struct layoutdriver_io_operations blocklayout_io_operations = {
 	.commit				= bl_commit,
 	.read_pagelist			= bl_read_pagelist,
@@ -1156,7 +1144,6 @@ static struct layoutdriver_io_operations blocklayout_io_operations = {
 static struct layoutdriver_policy_operations blocklayout_policy_operations = {
 	.get_stripesize			= bl_get_stripesize,
 	.pg_test			= bl_pg_test,
-	.do_flush			= bl_do_flush,
 };
 
 static struct pnfs_layoutdriver_type blocklayout_type = {
Signature · 1 line
1.6.6.1
#3 lore raw

PATCH 3/7 SQUASHME: pnfsblock: write_end adjust for removed ok_to_use_pnfs

---
 fs/nfs/blocklayout/blocklayout.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
fs/nfs/blocklayout/blocklayout.c +4 -9
index eb5760f..b1df445 100644
@@ -1027,17 +1027,12 @@ bl_write_begin(struct pnfs_layout_segment *lseg, struct page *page, loff_t pos,
 /* CAREFUL - what happens if copied < count??? */
 static int
 bl_write_end(struct inode *inode, struct page *page, loff_t pos,
-	     unsigned count, unsigned copied, struct pnfs_fsdata *fsdata)
+	     unsigned count, unsigned copied, struct pnfs_layout_segment *lseg)
 {
-	dprintk("%s enter, %u@%lld, %i\n", __func__, count, pos,
-		fsdata ? fsdata->ok_to_use_pnfs : -1);
+	dprintk("%s enter, %u@%lld, lseg=%p\n", __func__, count, pos, lseg);
 	print_page(page);
-	if (fsdata) {
-		if (fsdata->ok_to_use_pnfs) {
-			dprintk("%s using pnfs\n", __func__);
-			SetPageUptodate(page);
-		}
-	}
+	if (lseg)
+		SetPageUptodate(page);
 	return 0;
 }
 
Signature · 1 line
1.6.6.1
#4 lore raw

PATCH 4/7 SQUASHME: pnfsblock: write_end_cleanup adjust for removed ok_to_use_pnfs

---
 fs/nfs/blocklayout/blocklayout.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
fs/nfs/blocklayout/blocklayout.c +6 -1
index b1df445..43a5617 100644
@@ -1048,9 +1048,13 @@ bl_write_end_cleanup(struct file *filp, struct pnfs_fsdata *fsdata)
 	sector_t *pos;
 	struct address_space *mapping = filp->f_mapping;
 	struct pnfs_fsdata *fake_data;
+	struct pnfs_layout_segment *lseg;
 
 	if (!fsdata)
 		return;
+	lseg = fsdata->lseg;
+	if (!lseg)
+		return;
 	pos = fsdata->private;
 	if (!pos)
 		return;
@@ -1079,7 +1083,8 @@ bl_write_end_cleanup(struct file *filp, struct pnfs_fsdata *fsdata)
 				unlock_page(page);
 				continue;
 			}
-			fake_data->ok_to_use_pnfs = 1;
+			get_lseg(lseg);
+			fake_data->lseg = lseg;
 			fake_data->bypass_eof = 1;
 			mapping->a_ops->write_end(filp, mapping,
 						  index << PAGE_CACHE_SHIFT,
Signature · 1 line
1.6.6.1
#5 lore raw

PATCH 5/7 SQUASHME: pnfsblock: bl_write_pagelist support functions adjust for missing PG_USE_PNFS

---
 fs/nfs/blocklayout/blocklayout.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
fs/nfs/blocklayout/blocklayout.c +3 -5
index 43a5617..77e9512 100644
@@ -1115,12 +1115,10 @@ bl_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
 	   struct nfs_page *req)
 {
 	dprintk("%s enter\n", __func__);
-	if (pgio->pg_iswrite) {
-		return test_bit(PG_USE_PNFS, &prev->wb_flags) ==
-			test_bit(PG_USE_PNFS, &req->wb_flags);
-	} else {
+	if (pgio->pg_iswrite)
+		return prev->wb_lseg == req->wb_lseg;
+	else
 		return 1;
-	}
 }
 
 static struct layoutdriver_io_operations blocklayout_io_operations = {
Signature · 1 line
1.6.6.1
#6 lore raw

PATCH 6/7 SQUASHME: pnfsblock: bl_write_pagelist adjust for missing PG_USE_PNFS

---
 fs/nfs/blocklayout/blocklayout.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfs/blocklayout/blocklayout.c +2 -2
index 77e9512..92f0b4b 100644
@@ -448,8 +448,8 @@ bl_write_pagelist(struct pnfs_layout_type *lo,
 	int pg_index = pgbase >> PAGE_CACHE_SHIFT;
 
 	dprintk("%s enter, %Zu@%lld\n", __func__, count, offset);
-	if (!test_bit(PG_USE_PNFS, &wdata->req->wb_flags)) {
-		dprintk("PG_USE_PNFS not set\n");
+	if (!wdata->req->wb_lseg) {
+		dprintk("%s no lseg, falling back to MDS\n", __func__);
 		return PNFS_NOT_ATTEMPTED;
 	}
 	if (dont_like_caller(wdata->req)) {
Signature · 1 line
1.6.6.1
#7 lore raw

PATCH 7/7 pnfs: Revert "pnfs_post_submit: Restore "pnfs: pnfs_do_flush" part 2"

Now that block does not use do_flush, it can be removed entirely

Conflicts:

fs/nfs/pnfs.c
fs/nfs/pnfs.h

---
 fs/nfs/pnfs.c             |   14 --------------
 fs/nfs/pnfs.h             |   24 ------------------------
 fs/nfs/write.c            |    4 ++--
 include/linux/nfs4_pnfs.h |    3 ---
 4 files changed, 2 insertions(+), 43 deletions(-)
fs/nfs/pnfs.c +0 -14
index d6ba358..10f133c 100644
@@ -1716,20 +1716,6 @@ int _pnfs_write_end(struct inode *inode, struct page *page,
 	return status;
 }
 
- /* Given an nfs request, determine if it should be flushed before proceeding.
- * It should default to returning False, returning True only if there is a
- * specific reason to flush.
- */
-int _pnfs_do_flush(struct inode *inode, struct nfs_page *req)
-{
-	struct nfs_server *nfss = NFS_SERVER(inode);
-	int status = 0;
-
-	/* Note that lseg==NULL may be useful info for do_flush */
-	status = nfss->pnfs_curr_ld->ld_policy_ops->do_flush(req->wb_lseg, req);
-	return status;
-}
-
 enum pnfs_try_status
 _pnfs_try_to_write_data(struct nfs_write_data *data,
 			const struct rpc_call_ops *call_ops, int how)
fs/nfs/pnfs.h +0 -24
index fd7c532..53308df 100644
@@ -77,7 +77,6 @@ int _pnfs_write_begin(struct inode *inode, struct page *page,
 int _pnfs_write_end(struct inode *inode, struct page *page,
 		    loff_t pos, unsigned len, unsigned copied,
 		    struct pnfs_layout_segment *lseg);
-int _pnfs_do_flush(struct inode *inode, struct nfs_page *req);
 
 #define PNFS_EXISTS_LDIO_OP(srv, opname) ((srv)->pnfs_curr_ld &&	\
 				     (srv)->pnfs_curr_ld->ld_io_ops &&	\
@@ -186,24 +185,6 @@ static inline int pnfs_write_begin(struct file *filp, struct page *page,
 	return status;
 }
 
-/* req may not be locked, so we have to be prepared for req->wb_page being
- * set to NULL at any time.
- */
-static inline int pnfs_do_flush(struct nfs_page *req)
-{
-	struct page *page = req->wb_page;
-	struct inode *inode;
-
-	if (!page)
-		return 1;
-	inode = page->mapping->host;
-
-	if (PNFS_EXISTS_LDPOLICY_OP(NFS_SERVER(inode), do_flush))
-		return _pnfs_do_flush(inode, req);
-	else
-		return 0;
-}
-
 static inline int pnfs_write_end(struct file *filp, struct page *page,
 				 loff_t pos, unsigned len, unsigned copied,
 				 struct pnfs_layout_segment *lseg)
@@ -335,11 +316,6 @@ pnfs_try_to_commit(struct nfs_write_data *data,
 	return PNFS_NOT_ATTEMPTED;
 }
 
-static inline int pnfs_do_flush(struct nfs_page *req)
-{
-	return 0;
-}
-
 static inline int pnfs_write_begin(struct file *filp, struct page *page,
 				   loff_t pos, unsigned len,
 				   struct pnfs_layout_segment *lseg,
fs/nfs/write.c +2 -2
index 0dee870..ea36845 100644
@@ -603,7 +603,7 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode,
 		 * have flushed out requests having wrong owners.
 		 */
 		if (offset > rqend || end < req->wb_offset ||
-		    req->wb_lseg != lseg || pnfs_do_flush(req))
+		    req->wb_lseg != lseg)
 			goto out_flushme;
 
 		if (nfs_set_page_tag_locked(req))
@@ -712,7 +712,7 @@ int nfs_flush_incompatible(struct file *file, struct page *page,
 		if (req == NULL)
 			return 0;
 		do_flush = req->wb_page != page || req->wb_context != ctx ||
-			req->wb_lseg != lseg || pnfs_do_flush(req);
+			req->wb_lseg != lseg;
 		nfs_release_request(req);
 		if (!do_flush)
 			return 0;
include/linux/nfs4_pnfs.h +0 -3
index b7772c8..7016305 100644
@@ -210,9 +210,6 @@ struct layoutdriver_policy_operations {
 	/* test for nfs page cache coalescing */
 	int (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *);
 
-	/* Test for pre-write request flushing */
-	int (*do_flush)(struct pnfs_layout_segment *lseg, struct nfs_page *req);
-
 	/* Retreive the block size of the file system.
 	 * If gather_across_stripes == 1, then the file system will gather
 	 * requests into the block size.
Signature · 1 line
1.6.6.1
#8 lore raw
In reply to Fred Isaman
Quoted 6 lines · Fred Isaman

These patches, applied to the head of pnfs-all-latest after rebase, bring the blocklayout back in synch with the generic code changed by my previous patches and the rebase. The final tree containing the fully rebased tree with these patches applied is at
git://linux-nfs.org/~isaman/pnfs-block.git in the branch for-benny-20100611.

Grate Fred with a git tree it is actually usable.

I will clone your tree. And'll inspect it carefully on the flight. I want to do even more. I'd like to rebase them over an Alexandros-less patchset and actually test them. How hard will that be? Perhaps you might have a branch based on 2.6.34 without Alexandros patches that are up to date? Could you push it for me?

Quoted 2 lines

Fred

Thanks
Boaz

#9 lore raw
Quoted 8 lines · Boaz Harrosh
Quoted 6 lines · Fred Isaman

These patches, applied to the head of pnfs-all-latest after rebase, bring the blocklayout back in synch with the generic code changed by my previous patches and the rebase.  The final tree containing the fully rebased tree with these patches applied is at
git://linux-nfs.org/~isaman/pnfs-block.git in the branch for-benny-20100611.

Quoted 8 lines

Grate Fred with a git tree it is actually usable.

I will clone your tree. And'll inspect it carefully on the flight. I want to do even more. I'd like to rebase them over an Alexandros-less patchset and actually test them. How hard will that be? Perhaps you might have a branch based on 2.6.34 without Alexandros patches that are up to date? Could you push it for me?

I switched the order of the two patchsets at one point, and it wasn't too hard. The original patchset I submitted was based directly on the then pnfs-submit tree.

Right now something is wrong with my connection between here and linux-nfs.org. At the current rate, the push of the tree I mentioned above will be done in about 10 hours :(

I don't think I'll be pushing any other tree soon.

Fred

Quoted 10 lines
Quoted 2 lines

Fred

Thanks
Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#10 lore raw
Quoted 22 lines · Fred Isaman
Quoted 8 lines · Boaz Harrosh
Quoted 6 lines · Fred Isaman

These patches, applied to the head of pnfs-all-latest after rebase, bring the blocklayout back in synch with the generic code changed by my previous patches and the rebase. The final tree containing the fully rebased tree with these patches applied is at
git://linux-nfs.org/~isaman/pnfs-block.git in the branch for-benny-20100611.

Quoted 8 lines

Grate Fred with a git tree it is actually usable.

I will clone your tree. And'll inspect it carefully on the flight. I want to do even more. I'd like to rebase them over an Alexandros-less patchset and actually test them. How hard will that be? Perhaps you might have a branch based on 2.6.34 without Alexandros patches that are up to date? Could you push it for me?

I switched the order of the two patchsets at one point, and it wasn't too hard. The original patchset I submitted was based directly on the then pnfs-submit tree.

Quoted 10 lines

Right now something is wrong with my connection between here and linux-nfs.org. At the current rate, the push of the tree I mentioned above will be done in about 10 hours :(

I don't think I'll be pushing any other tree soon.

Fred

Quoted 2 lines
Quoted 2 lines

Fred

Fred I get:

$ git ls-remote git://linux-nfs.org/~isaman/pnfs-block.git
fatal: The remote end hung up unexpectedly

Maybe it's that you are pushing, or there might be a problem. Perhaps check the permission, or maybe it needs added to git-daemon (and service restart)

Benny's tree access is fine.

I'll try to connect from home on Saturday and clone it. See if you can fix the access problem when you are done.

BTW: it should not take so long. You should first clone a tree from
Benny, locally. Do you have a ssh access? then pusshing just your changes should be very fast. Perhaps you are pushing the full tree by dialup, that's not smart.

Boaz

#11 lore raw

On Fri, Jun 11, 2010 at 4:58 AM, Boaz Harrosh <[email protected]> wr= ote:

Quoted 2 lines · Fred Isaman
Quoted 1 line

On Fri, Jun 11, 2010 at 4:07 AM, Boaz Harrosh <[email protected]>=

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines · Fred Isaman
Quoted 1 line

These patches, applied to the head of pnfs-all-latest after rebase=

, bring

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the blocklayout back in synch with the generic code changed by my =

previous

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

patches and the rebase. =A0The final tree containing the fully reb=

ased tree

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

with these patches applied is at
git://linux-nfs.org/~isaman/pnfs-block.git in the branch for-benny=

-20100611.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Grate Fred with a git tree it is actually usable.

I will clone your tree. And'll inspect it carefully on the flight. I want to do even more. I'd like to rebase them over an Alexandros-=

less

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

patchset and actually test them. How hard will that be? Perhaps you might have a branch based on 2.6.34 without Alexandros patches that are up to date? Could you push it for me?

I switched the order of the two patchsets at one point, and it wasn'=

t too hard.

Quoted 4 lines
Quoted 4 lines

The original patchset I submitted was based directly on the then pnfs-submit tree.

Right now something is wrong with my connection between here and lin=

ux-nfs.org.

Quoted 18 lines
Quoted 9 lines

At the current rate, the push of the tree I mentioned above will be done in about 10 hours :(

I don't think I'll be pushing any other tree soon.

Fred

Quoted 2 lines
Quoted 2 lines

Fred

Fred I get:

$ git ls-remote git://linux-nfs.org/~isaman/pnfs-block.git
fatal: The remote end hung up unexpectedly

Maybe it's that you are pushing, or there might be a problem. Perhaps check the permission, or maybe it needs added to git-daemon (and service restart)

Quoted 7 lines

Benny's tree access is fine.

I'll try to connect from home on Saturday and clone it. See if you can fix the access problem when you are done.

BTW: it should not take so long. You should first clone a tree from =A0 =A0 Benny, locally. Do you have a ssh access? then pusshing just =

your

Quoted 7 lines

=A0 =A0 changes should be very fast. Perhaps you are pushing the full =A0 =A0 tree by dialup, that's not smart.

Boaz

OK, it has finished, and seems to be working now.

=46red

Quoted 3 lines