pnfs-submit code removal patches
Subsystems (2)
cover pnfs-submit code removal patches
All these patches should be immediately reverted in the post-submit branch.
The first three take advantage of the fact that we are only using full-file layouts to remove some code.
The fourth is a repeat of a previously sent patch that seems to have fallen throught the the cracks.
Fred
PATCH 1/4 pnfs-submit: Rely on full-file layout assumption to clean out some code
Note that even assuming full file layout, there can still be two lsegs, one for each iomode.
--- fs/nfs/pnfs.c | 85 +------------------------------------------------------- 1 files changed, 2 insertions(+), 83 deletions(-)
fs/nfs/pnfs.c +2 -83
@@ -444,65 +444,6 @@ put_lseg(struct pnfs_layout_segment *lseg) }EXPORT_SYMBOL (put_lseg); -static inline u64 -end_offset (u64 start,u64 len) -{ -u64 end; - - end = start + len; -return end >= start ? end:NFS4_MAX_UINT64 ; -} - -/* last octet in a range */ -static inline u64 -last_byte_offset (u64 start,u64 len) -{ -u64 end; - -BUG_ON (!len); - end = start + len; -return end > start ? end -1 :NFS4_MAX_UINT64 ; -} - -/* -* is l2 fully contained in l1? -* start1 end1 -* [----------------------------------) -* start2 end2 -* [----------------) -*/ -static inline int -lo_seg_contained (struct nfs4_pnfs_layout_segment *l1, -struct nfs4_pnfs_layout_segment *l2) -{ -u64 start1 = l1->offset; -u64 end1 =end_offset (start1, l1->length); -u64 start2 = l2->offset; -u64 end2 =end_offset (start2, l2->length); - -return (start1 <= start2) && (end1 >= end2); -} - -/* -* is l1 and l2 intersecting? -* start1 end1 -* [----------------------------------) -* start2 end2 -* [----------------) -*/ -static inline int -lo_seg_intersecting (struct nfs4_pnfs_layout_segment *l1, -struct nfs4_pnfs_layout_segment *l2) -{ -u64 start1 = l1->offset; -u64 end1 =end_offset (start1, l1->length); -u64 start2 = l2->offset; -u64 end2 =end_offset (start2, l2->length); - -return (end1 ==NFS4_MAX_UINT64 || end1 > start2) && - (end2 ==NFS4_MAX_UINT64 || end2 > start1); -} -void pnfs_set_layout_stateid (struct pnfs_layout_type *lo,const nfs4_stateid *stateid)
@@ -616,8 +557,7 @@ should_free_lseg(struct pnfs_layout_segment *lseg, struct nfs4_pnfs_layout_segment *range) {return (range->iomode ==IOMODE_ANY || - lseg->range.iomode == range->iomode) && -lo_seg_intersecting (&lseg->range, range); + lseg->range.iomode == range->iomode); } static struct pnfs_layout_segment *
@@ -832,18 +772,6 @@ static inline s64 cmp_layout(struct nfs4_pnfs_layout_segment *l1, struct nfs4_pnfs_layout_segment *l2) { - s64 d; - -/* higher offset > lower offset */ - d = l1->offset - l2->offset; -if (d) -return d; - -/* longer length > shorter length */ - d = l1->length - l2->length; -if (d) -return d; - /* read > read/write */ return (int)(l1->iomode == IOMODE_READ) - (int )(l2->iomode ==IOMODE_READ );
@@ -1004,16 +932,7 @@ static inline int has_matching_lseg(struct pnfs_layout_segment *lseg, struct nfs4_pnfs_layout_segment *range) { - struct nfs4_pnfs_layout_segment range1; - -if ((range->iomode ==IOMODE_RW && lseg->range.iomode !=IOMODE_RW ) || - !lo_seg_intersecting (&lseg->range, range)) -return 0 ; - -/* range1 covers only the first byte in the range */ - range1 = *range; - range1.length =1 ; -return lo_seg_contained (&lseg->range, &range1); +return (range->iomode !=IOMODE_RW || lseg->range.iomode ==IOMODE_RW ); }/*
Signature · 1 line
1.6.6.1
PATCH 2/4 pnfs-submit: Remove readahead_range
This is not needed if we always use full file layout.
--- fs/nfs/pnfs.c | 47 +++++++---------------------------------------- 1 files changed, 7 insertions(+), 40 deletions(-)
fs/nfs/pnfs.c +7 -40
@@ -1196,32 +1196,6 @@ out: }void -readahead_range (struct inode *inode,struct list_head *pages,loff_t *offset, -size_t *count) -{ -struct page *first, *last; -loff_t foff, i_size =i_size_read (inode); -pgoff_t end_index = (i_size -1 ) >>PAGE_CACHE_SHIFT ; -size_t range; - - - first = list_entry((pages)->prev, struct page, lru); - last = list_entry((pages)->next, struct page, lru); - - foff = (loff_t )first->index <<PAGE_CACHE_SHIFT ; - - range = (last->index - first->index) *PAGE_CACHE_SIZE ; -if (last->index == end_index) - range += ((i_size -1 ) & ~PAGE_CACHE_MASK ) +1 ; -else - range +=PAGE_CACHE_SIZE ; -dprintk ("%s foff %lu, range %Zu\n" , __func__, (unsigned long )foff, - range); - *offset = foff; - *count = range; -} - -void pnfs_set_pg_test (struct inode *inode,struct nfs_pageio_descriptor *pgio) {struct pnfs_layout_type *laytype;
@@ -1280,8 +1254,6 @@ pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, struct list_head *pages) {struct nfs_server *nfss =NFS_SERVER (inode); -size_t count =0 ; -loff_t loff; pgio->pg_iswrite =0 ; pgio->pg_boundary =0 ;
@@ -1291,19 +1263,14 @@ pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,if (!pnfs_enabled_sb (nfss))return ; -/* Calculate the total read-ahead count */ -readahead_range (inode, pages, &loff, &count); - -if (count >0 ) { -_pnfs_update_layout (inode, ctx, loff, count,IOMODE_READ , - &pgio->pg_lseg); -if (!pgio->pg_lseg) -return ; +_pnfs_update_layout (inode, ctx,0 ,NFS4_MAX_UINT64 ,IOMODE_READ , + &pgio->pg_lseg); +if (!pgio->pg_lseg) +return ; - pgio->pg_boundary =pnfs_getboundary (inode); -if (pgio->pg_boundary) -pnfs_set_pg_test (inode, pgio); - } + pgio->pg_boundary =pnfs_getboundary (inode); +if (pgio->pg_boundary) +pnfs_set_pg_test (inode, pgio); }void
Signature · 1 line
1.6.6.1
PATCH 3/4 pnfs-submit: Remove offset and count arguments from pnfs_update_layout
They are not needed since we only use whole file layouts.
--- fs/nfs/file.c | 2 +- fs/nfs/pnfs.c | 5 +---- fs/nfs/pnfs.h | 8 ++++---- fs/nfs/read.c | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-)
fs/nfs/file.c +1 -1
@@ -399,7 +399,7 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping,pnfs_update_layout (mapping->host,nfs_file_open_context (file), -0 ,NFS4_MAX_UINT64 ,IOMODE_RW , +IOMODE_RW , &lseg); start:/*
fs/nfs/pnfs.c +1 -4
@@ -976,8 +976,6 @@ pnfs_has_layout(struct pnfs_layout_type *lo,void _pnfs_update_layout (struct inode *ino,struct nfs_open_context *ctx, -loff_t pos, -u64 count,enum pnfs_iomode iomode,struct pnfs_layout_segment **lsegpp) {
@@ -1263,8 +1261,7 @@ pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,if (!pnfs_enabled_sb (nfss))return ; -_pnfs_update_layout (inode, ctx,0 ,NFS4_MAX_UINT64 ,IOMODE_READ , - &pgio->pg_lseg); +_pnfs_update_layout (inode, ctx,IOMODE_READ , &pgio->pg_lseg);if (!pgio->pg_lseg)return ;
fs/nfs/pnfs.h +4 -4
@@ -34,7 +34,7 @@ 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, +enum pnfs_iomode access_type,struct pnfs_layout_segment **lsegpp); int _pnfs_return_layout(struct inode *, struct nfs4_pnfs_layout_segment *,
@@ -175,13 +175,13 @@ static inline int pnfs_return_layout(struct inode *ino,static inline void pnfs_update_layout (struct inode *ino,struct nfs_open_context *ctx, -loff_t pos,u64 count,enum pnfs_iomode access_type, +enum pnfs_iomode access_type,struct pnfs_layout_segment **lsegpp) {struct nfs_server *nfss =NFS_SERVER (ino);if (pnfs_enabled_sb (nfss)) -_pnfs_update_layout (ino, ctx, pos, count, access_type, lsegpp); +_pnfs_update_layout (ino, ctx, access_type, lsegpp);else {if (lsegpp) *lsegpp =NULL ;
@@ -200,7 +200,7 @@ static inline void put_lseg(struct pnfs_layout_segment *lseg)static inline void pnfs_update_layout (struct inode *ino,struct nfs_open_context *ctx, -loff_t pos,u64 count,enum pnfs_iomode access_type, +enum pnfs_iomode access_type,struct pnfs_layout_segment **lsegpp) {if (lsegpp)
fs/nfs/read.c +1 -1
@@ -126,7 +126,7 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, len =nfs_page_length (page);if (len ==0 )return nfs_return_empty_page (page); -pnfs_update_layout (inode, ctx,0 ,NFS4_MAX_UINT64 ,IOMODE_READ , &lseg); +pnfs_update_layout (inode, ctx,IOMODE_READ , &lseg); new =nfs_create_request (ctx, inode, page,0 , len, lseg);put_lseg (lseg);if (IS_ERR (new)) {
Signature · 1 line
1.6.6.1
PATCH 4/4 pnfs-submit: Remove unused encode_getattr_three code
This is not used by file layout
--- fs/nfs/nfs4xdr.c | 29 ----------------------------- 1 files changed, 0 insertions(+), 29 deletions(-)
fs/nfs/nfs4xdr.c +0 -29
@@ -1060,35 +1060,6 @@ static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm hdr->replen += decode_getattr_maxsz; } -static void -encode_getattr_three (struct xdr_stream *xdr, -uint32_t bm0,uint32_t bm1,uint32_t bm2, -struct compound_hdr *hdr) -{ -__be32 *p; - - p =reserve_space (xdr,4 ); - *p =cpu_to_be32 (OP_GETATTR ); -if (bm2) { - p =reserve_space (xdr,16 ); - *p++ =cpu_to_be32 (3 ); - *p++ =cpu_to_be32 (bm0); - *p++ =cpu_to_be32 (bm1); - *p =cpu_to_be32 (bm2); - }else if (bm1) { - p =reserve_space (xdr,12 ); - *p++ =cpu_to_be32 (2 ); - *p++ =cpu_to_be32 (bm0); - *p =cpu_to_be32 (bm1); - }else { - p =reserve_space (xdr,8 ); - *p++ =cpu_to_be32 (1 ); - *p =cpu_to_be32 (bm0); - } - hdr->nops++; - hdr->replen += decode_getattr_maxsz; -} -static void encode_getfattr (struct xdr_stream *xdr,const u32 * bitmask,struct compound_hdr *hdr) { encode_getattr_two(xdr, bitmask[0] & nfs4_fattr_bitmap[0],
Signature · 1 line
1.6.6.1
Quoted 7 lines · Fred Isaman
All these patches should be immediately reverted in the post-submit branch.
The first three take advantage of the fact that we are only using full-file layouts to remove some code.
The fourth is a repeat of a previously sent patch that seems to have fallen throught the the cracks.
Hmm, it looks like I had a pilot error on this one. Will fix.
Benny
Quoted 7 lines
Fred
--
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