The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH -mmotm] remove unused vma_page_offset()
@ 2008-06-27 11:12 Johannes Weiner
  2008-06-27 12:13 ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Weiner @ 2008-06-27 11:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Function has no callees, drop it.

Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
---

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 690abf0..a7c7c18 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -48,17 +48,6 @@ static DEFINE_SPINLOCK(hugetlb_lock);
 
 /*
  * Convert the address within this vma to the page offset within
- * the mapping, in base page units.
- */
-static pgoff_t vma_page_offset(struct vm_area_struct *vma,
-				unsigned long address)
-{
-	return ((address - vma->vm_start) >> PAGE_SHIFT) +
-					(vma->vm_pgoff >> PAGE_SHIFT);
-}
-
-/*
- * Convert the address within this vma to the page offset within
  * the mapping, in pagecache page units; huge pages here.
  */
 static pgoff_t vma_pagecache_offset(struct hstate *h,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -mmotm] remove unused vma_page_offset()
  2008-06-27 11:12 [PATCH -mmotm] remove unused vma_page_offset() Johannes Weiner
@ 2008-06-27 12:13 ` Hugh Dickins
  2008-06-27 12:37   ` Johannes Weiner
  0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2008-06-27 12:13 UTC (permalink / raw)
  To: Johannes Weiner; +Cc: Andrew Morton, Andy Whitcroft, linux-kernel

On Fri, 27 Jun 2008, Johannes Weiner wrote:
> Function has no callees, drop it.
> 
> Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
> ---

Yes, I noticed that too; but I also thought vma_pagecache_offset()
below it needs a name change, and was planning on sending Andrew
the patch at the end, okay to replace yours with that?

Hugh

> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 690abf0..a7c7c18 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -48,17 +48,6 @@ static DEFINE_SPINLOCK(hugetlb_lock);
>  
>  /*
>   * Convert the address within this vma to the page offset within
> - * the mapping, in base page units.
> - */
> -static pgoff_t vma_page_offset(struct vm_area_struct *vma,
> -				unsigned long address)
> -{
> -	return ((address - vma->vm_start) >> PAGE_SHIFT) +
> -					(vma->vm_pgoff >> PAGE_SHIFT);
> -}
> -
> -/*
> - * Convert the address within this vma to the page offset within
>   * the mapping, in pagecache page units; huge pages here.
>   */
>  static pgoff_t vma_pagecache_offset(struct hstate *h,

From: Johannes Weiner <hannes@saeurebad.de>

vma_page_offset() has no callees: drop it.

Hugh adds: vma_pagecache_offset() has a dangerously misleading name,
since it's using hugepage units: rename it to vma_hugecache_offset().

Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
---

 mm/hugetlb.c |   21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

--- a/mm/hugetlb.c	2008-06-25 12:45:11.000000000 +0100
+++ b/mm/hugetlb.c	2008-06-25 19:02:42.000000000 +0100
@@ -48,20 +48,9 @@ static DEFINE_SPINLOCK(hugetlb_lock);
 
 /*
  * Convert the address within this vma to the page offset within
- * the mapping, in base page units.
- */
-static pgoff_t vma_page_offset(struct vm_area_struct *vma,
-				unsigned long address)
-{
-	return ((address - vma->vm_start) >> PAGE_SHIFT) +
-					(vma->vm_pgoff >> PAGE_SHIFT);
-}
-
-/*
- * Convert the address within this vma to the page offset within
  * the mapping, in pagecache page units; huge pages here.
  */
-static pgoff_t vma_pagecache_offset(struct hstate *h,
+static pgoff_t vma_hugecache_offset(struct hstate *h,
 			struct vm_area_struct *vma, unsigned long address)
 {
 	return ((address - vma->vm_start) >> huge_page_shift(h)) +
@@ -786,7 +775,7 @@ static int vma_needs_reservation(struct 
 	struct inode *inode = mapping->host;
 
 	if (vma->vm_flags & VM_SHARED) {
-		pgoff_t idx = vma_pagecache_offset(h, vma, addr);
+		pgoff_t idx = vma_hugecache_offset(h, vma, addr);
 		return region_chg(&inode->i_mapping->private_list,
 							idx, idx + 1);
 
@@ -804,7 +793,7 @@ static void vma_commit_reservation(struc
 	struct inode *inode = mapping->host;
 
 	if (vma->vm_flags & VM_SHARED) {
-		pgoff_t idx = vma_pagecache_offset(h, vma, addr);
+		pgoff_t idx = vma_hugecache_offset(h, vma, addr);
 		region_add(&inode->i_mapping->private_list, idx, idx + 1);
 	}
 }
@@ -1761,7 +1750,7 @@ static struct page *hugetlbfs_pagecache_
 	pgoff_t idx;
 
 	mapping = vma->vm_file->f_mapping;
-	idx = vma_pagecache_offset(h, vma, address);
+	idx = vma_hugecache_offset(h, vma, address);
 
 	return find_lock_page(mapping, idx);
 }
@@ -1790,7 +1779,7 @@ static int hugetlb_no_page(struct mm_str
 	}
 
 	mapping = vma->vm_file->f_mapping;
-	idx = vma_pagecache_offset(h, vma, address);
+	idx = vma_hugecache_offset(h, vma, address);
 
 	/*
 	 * Use page lock to guard against racing truncation

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -mmotm] remove unused vma_page_offset()
  2008-06-27 12:13 ` Hugh Dickins
@ 2008-06-27 12:37   ` Johannes Weiner
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Weiner @ 2008-06-27 12:37 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Andrew Morton, Andy Whitcroft, linux-kernel

Hi,

Hugh Dickins <hugh@veritas.com> writes:

> On Fri, 27 Jun 2008, Johannes Weiner wrote:
>> Function has no callees, drop it.
>> 
>> Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
>> ---
>
> Yes, I noticed that too; but I also thought vma_pagecache_offset()
> below it needs a name change, and was planning on sending Andrew
> the patch at the end, okay to replace yours with that?

Jawohl, that's fine with me.

	Hannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-27 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-27 11:12 [PATCH -mmotm] remove unused vma_page_offset() Johannes Weiner
2008-06-27 12:13 ` Hugh Dickins
2008-06-27 12:37   ` Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox