Skip to contentSkip to conversation

staging: erofs: removing an extra call to iloc() in fill_inode()

PATCH New Pratik Shinde 3 participants 7 messages Aug 13, 2019 – Aug 14, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: erofs: removing an extra call to iloc() in fill_inode()

in fill_inode() we call iloc() twice.Avoiding the extra call by storing the result.

Signed-off-by Pratik Shinde <pratikshinde320 at gmail.com>
---
 drivers/staging/erofs/inode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/erofs/inode.c +4 -3
index 4c3d8bf..d82ba6c 100644
@@ -167,11 +167,12 @@ static int fill_inode(struct inode *inode, int isdir)
 	int err;
 	erofs_blk_t blkaddr;
 	unsigned int ofs;
+	erofs_off_t inode_loc;
 
 	trace_erofs_fill_inode(inode, isdir);
-
-	blkaddr = erofs_blknr(iloc(sbi, vi->nid));
-	ofs = erofs_blkoff(iloc(sbi, vi->nid));
+	inode_loc = iloc(sbi, vi->nid);
+	blkaddr = erofs_blknr(inode_loc);
+	ofs = erofs_blkoff(inode_loc);
 
 	debugln("%s, reading inode nid %llu at %u of blkaddr %u",
 		__func__, vi->nid, ofs, blkaddr);
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/1 staging: erofs: removing an extra call to iloc() in fill_inode()

Hi Pratik,

Quoted 4 lines · Pratik Shinde

in fill_inode() we call iloc() twice.Avoiding the extra call by storing the result.

Signed-off-by Pratik Shinde <pratikshinde320 at gmail.com>

I have no objection of this patch, but I'd like to hear Chao/Greg's idea about this...

Thanks,
Gao Xiang

Quoted 27 lines
---
 drivers/staging/erofs/inode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/erofs/inode.c +4 -3
index 4c3d8bf..d82ba6c 100644
@@ -167,11 +167,12 @@ static int fill_inode(struct inode *inode, int isdir)
 	int err;
 	erofs_blk_t blkaddr;
 	unsigned int ofs;
+	erofs_off_t inode_loc;
 
 	trace_erofs_fill_inode(inode, isdir);
-
-	blkaddr = erofs_blknr(iloc(sbi, vi->nid));
-	ofs = erofs_blkoff(iloc(sbi, vi->nid));
+	inode_loc = iloc(sbi, vi->nid);
+	blkaddr = erofs_blknr(inode_loc);
+	ofs = erofs_blkoff(inode_loc);
 
 	debugln("%s, reading inode nid %llu at %u of blkaddr %u",
 		__func__, vi->nid, ofs, blkaddr);
Signature · 1 line
2.9.3
#2 lore raw

PATCH 1/1 staging: erofs: removing an extra call to iloc() in fill_inode()

Quoted 10 lines · Gao Xiang

Hi Pratik,

Quoted 4 lines · Pratik Shinde

in fill_inode() we call iloc() twice.Avoiding the extra call by storing the result.

Signed-off-by Pratik Shinde <pratikshinde320 at gmail.com>

I have no objection of this patch, but I'd like to hear Chao/Greg's idea about this...

It looks more clean. :)

Nitpick, maybe change 'inode_loc' to shorter 'iloc' will be better.

Reviewed-by Chao Yu <yuchao0 at huawei.com>

Thanks,

Quoted 33 lines

Thanks,
Gao Xiang

Quoted 27 lines
---
 drivers/staging/erofs/inode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/erofs/inode.c +4 -3
index 4c3d8bf..d82ba6c 100644
@@ -167,11 +167,12 @@ static int fill_inode(struct inode *inode, int isdir)
 	int err;
 	erofs_blk_t blkaddr;
 	unsigned int ofs;
+	erofs_off_t inode_loc;
 
 	trace_erofs_fill_inode(inode, isdir);
-
-	blkaddr = erofs_blknr(iloc(sbi, vi->nid));
-	ofs = erofs_blkoff(iloc(sbi, vi->nid));
+	inode_loc = iloc(sbi, vi->nid);
+	blkaddr = erofs_blknr(inode_loc);
+	ofs = erofs_blkoff(inode_loc);
 
 	debugln("%s, reading inode nid %llu at %u of blkaddr %u",
 		__func__, vi->nid, ofs, blkaddr);
Signature · 1 line
2.9.3

.

#3 lore raw

PATCH 1/1 staging: erofs: removing an extra call to iloc() in fill_inode()

Quoted 7 lines · Chao Yu
Quoted 6 lines · Gao Xiang

Hi Pratik,

Quoted 3 lines · Pratik Shinde

in fill_inode() we call iloc() twice.Avoiding the extra call by storing the result.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Pratik Shinde <pratikshinde320 at gmail.com>

I have no objection of this patch, but I'd like to hear Chao/Greg's idea about this...

It looks more clean. :)

Nitpick, maybe change 'inode_loc' to shorter 'iloc' will be better.

iloc is the name of static inline helper function in internal.h used for shorter lines...

Thanks,
Gao Xiang

Quoted 38 lines
Reviewed-by Chao Yu <yuchao0 at huawei.com>

Thanks,

Quoted 33 lines

Thanks,
Gao Xiang

Quoted 27 lines
---
 drivers/staging/erofs/inode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/erofs/inode.c +4 -3
index 4c3d8bf..d82ba6c 100644
@@ -167,11 +167,12 @@ static int fill_inode(struct inode *inode, int isdir)
 	int err;
 	erofs_blk_t blkaddr;
 	unsigned int ofs;
+	erofs_off_t inode_loc;
 
 	trace_erofs_fill_inode(inode, isdir);
-
-	blkaddr = erofs_blknr(iloc(sbi, vi->nid));
-	ofs = erofs_blkoff(iloc(sbi, vi->nid));
+	inode_loc = iloc(sbi, vi->nid);
+	blkaddr = erofs_blknr(inode_loc);
+	ofs = erofs_blkoff(inode_loc);
 
 	debugln("%s, reading inode nid %llu at %u of blkaddr %u",
 		__func__, vi->nid, ofs, blkaddr);
Signature · 1 line
2.9.3

.

#4 lore raw

PATCH 1/1 staging: erofs: removing an extra call to iloc() in fill_inode()

Yes.since we already have a function with same name (and we are using it in same context).
'inode_loc' was the most meaningful name I could come up with :)

--Pratik.

Quoted 36 lines · Gao Xiang
Quoted 7 lines · Chao Yu
Quoted 6 lines · Gao Xiang

Hi Pratik,

Quoted 3 lines · Pratik Shinde

in fill_inode() we call iloc() twice.Avoiding the extra call by storing the result.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Pratik Shinde <pratikshinde320 at gmail.com>

I have no objection of this patch, but I'd like to hear Chao/Greg's idea about this...

It looks more clean. :)

Nitpick, maybe change 'inode_loc' to shorter 'iloc' will be better.

iloc is the name of static inline helper function in internal.h used for shorter lines...

Thanks,
Gao Xiang

Quoted 13 lines
Reviewed-by Chao Yu <yuchao0 at huawei.com>

Thanks,

Quoted 8 lines

Thanks,
Gao Xiang

Quoted 4 lines
---
 drivers/staging/erofs/inode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Quoted 28 lines
Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/staging/erofs/inode.c

Quoted 4 lines
Quoted 4 lines

drivers/staging/erofs/inode.c static int fill_inode(struct inode *inode, int

Quoted 4 lines

index 4c3d8bf..d82ba6c 100644

drivers/staging/erofs/inode.c +0 -0
@@ -167,11 +167,12 @@ static int fill_inode(struct inode *inode, int

isdir)

Quoted 20 lines
Quoted 20 lines
Quoted 16 lines
drivers/staging/erofs/inode.c +4 -4
   int err;
   erofs_blk_t blkaddr;
   unsigned int ofs;
+  erofs_off_t inode_loc;
 
   trace_erofs_fill_inode(inode, isdir);
-
-  blkaddr = erofs_blknr(iloc(sbi, vi->nid));
-  ofs = erofs_blkoff(iloc(sbi, vi->nid));
+  inode_loc = iloc(sbi, vi->nid);
+  blkaddr = erofs_blknr(inode_loc);
+  ofs = erofs_blkoff(inode_loc);
 
   debugln("%s, reading inode nid %llu at %u of blkaddr %u",
           __func__, vi->nid, ofs, blkaddr);
--
Quoted 2 lines

2.9.3

.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linux-erofs/attachments/20190814/7db46d5c/attachment.htm>

#5 lore raw

PATCH 1/1 staging: erofs: removing an extra call to iloc() in fill_inode()

Quoted 3 lines · Pratik Shinde

Yes.since we already have a function with same name (and we are using it in same context).
'inode_loc' was the most meaningful name I could come up with :)

[snip]

Quoted 2 lines · Gao Xiang

iloc is the name of static inline helper function in internal.h used for shorter lines...

Correct, so let's keep as it is.

Thanks,

#6 lore raw

PATCH 1/1 staging: erofs: removing an extra call to iloc() in fill_inode()

In reply to Pratik Shinde
Quoted 5 lines · Pratik Shinde

Yes.since we already have a function with same name (and we are using it in same context).
'inode_loc' was the most meaningful name I could come up with :)

--Pratik.

And one more small suggestion... see the following,
https://lore.kernel.org/lkml/20190805044225.GA14087 at kroah.com/

Happy hacking! :)

Thanks,
Gao Xiang

Quoted 67 lines · Gao Xiang
Quoted 65 lines · Chao Yu
Quoted 7 lines · Gao Xiang
Quoted 6 lines

Hi Pratik,

Quoted 3 lines · Pratik Shinde

in fill_inode() we call iloc() twice.Avoiding the extra call by storing the result.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Pratik Shinde <pratikshinde320 at gmail.com>

I have no objection of this patch, but I'd like to hear Chao/Greg's idea about this...

It looks more clean. :)

Nitpick, maybe change 'inode_loc' to shorter 'iloc' will be better.

iloc is the name of static inline helper function in internal.h used for shorter lines...

Thanks,
Gao Xiang

Quoted 6 lines
Reviewed-by Chao Yu <yuchao0 at huawei.com>

Thanks,

Quoted 1 line
Quoted 8 lines
Quoted 8 lines

Thanks,
Gao Xiang

Review

Quoted 5 lines
---
 drivers/staging/erofs/inode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/erofs/inode.c

Quoted 4 lines
Quoted 4 lines

drivers/staging/erofs/inode.c static int fill_inode(struct inode *inode, int

Quoted 4 lines

index 4c3d8bf..d82ba6c 100644

drivers/staging/erofs/inode.c +0 -0
@@ -167,11 +167,12 @@ static int fill_inode(struct inode *inode, int

isdir)

Quoted 20 lines
Quoted 20 lines
Quoted 16 lines
drivers/staging/erofs/inode.c +4 -4
   int err;
   erofs_blk_t blkaddr;
   unsigned int ofs;
+  erofs_off_t inode_loc;
 
   trace_erofs_fill_inode(inode, isdir);
-
-  blkaddr = erofs_blknr(iloc(sbi, vi->nid));
-  ofs = erofs_blkoff(iloc(sbi, vi->nid));
+  inode_loc = iloc(sbi, vi->nid);
+  blkaddr = erofs_blknr(inode_loc);
+  ofs = erofs_blkoff(inode_loc);
 
   debugln("%s, reading inode nid %llu at %u of blkaddr %u",
           __func__, vi->nid, ofs, blkaddr);
--
Quoted 2 lines

2.9.3

.