Re: [PATCH 11/25] Unionfs: add un/likely conditionals on debug ops

2007-09-26 Thread roel
Erez Zadok wrote:
> Signed-off-by: Erez Zadok <[EMAIL PROTECTED]>
> ---
>  fs/unionfs/debug.c |  108 +++
>  1 files changed, 57 insertions(+), 51 deletions(-)
> 
> diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
> index 9546a41..09b52ce 100644
> --- a/fs/unionfs/debug.c
> +++ b/fs/unionfs/debug.c
> @@ -56,19 +56,19 @@ void __unionfs_check_inode(const struct inode *inode,
>   sb = inode->i_sb;
>   istart = ibstart(inode);
>   iend = ibend(inode);
> - if (istart > iend) {
> + if (unlikely(istart > iend)) {
>   PRINT_CALLER(fname, fxn, line);
>   printk(" Ci0: inode=%p istart/end=%d:%d\n",
>  inode, istart, iend);
>   }
> - if ((istart == -1 && iend != -1) ||
> - (istart != -1 && iend == -1)) {
> + if (unlikely((istart == -1 && iend != -1) ||
> +  (istart != -1 && iend == -1))) {

you could also do
if (unlikely((istart == -1 || iend == -1) && istart != iend)) {

[...]

> @@ -138,8 +139,8 @@ void __unionfs_check_dentry(const struct dentry *dentry,
>   dend = dbend(dentry);
>   BUG_ON(dstart > dend);
>  
> - if ((dstart == -1 && dend != -1) ||
> - (dstart != -1 && dend == -1)) {
> + if (unlikely((dstart == -1 && dend != -1) ||
> +  (dstart != -1 && dend == -1))) {

[...]

the same here

> @@ -223,30 +224,30 @@ void __unionfs_check_dentry(const struct dentry *dentry,
>   istart = ibstart(inode);
>   iend = ibend(inode);
>   BUG_ON(istart > iend);
> - if ((istart == -1 && iend != -1) ||
> - (istart != -1 && iend == -1)) {
> + if (unlikely((istart == -1 && iend != -1) ||
> +  (istart != -1 && iend == -1))) {

and here

[...]

> @@ -350,30 +354,30 @@ void __unionfs_check_file(const struct file *file,
>   fend = fbend(file);
>   BUG_ON(fstart > fend);
>  
> - if ((fstart == -1 && fend != -1) ||
> - (fstart != -1 && fend == -1)) {
> + if (unlikely((fstart == -1 && fend != -1) ||
> +  (fstart != -1 && fend == -1))) {

and here

[...]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 11/25] Unionfs: add un/likely conditionals on debug ops

2007-09-26 Thread roel
Erez Zadok wrote:
 Signed-off-by: Erez Zadok [EMAIL PROTECTED]
 ---
  fs/unionfs/debug.c |  108 +++
  1 files changed, 57 insertions(+), 51 deletions(-)
 
 diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
 index 9546a41..09b52ce 100644
 --- a/fs/unionfs/debug.c
 +++ b/fs/unionfs/debug.c
 @@ -56,19 +56,19 @@ void __unionfs_check_inode(const struct inode *inode,
   sb = inode-i_sb;
   istart = ibstart(inode);
   iend = ibend(inode);
 - if (istart  iend) {
 + if (unlikely(istart  iend)) {
   PRINT_CALLER(fname, fxn, line);
   printk( Ci0: inode=%p istart/end=%d:%d\n,
  inode, istart, iend);
   }
 - if ((istart == -1  iend != -1) ||
 - (istart != -1  iend == -1)) {
 + if (unlikely((istart == -1  iend != -1) ||
 +  (istart != -1  iend == -1))) {

you could also do
if (unlikely((istart == -1 || iend == -1)  istart != iend)) {

[...]

 @@ -138,8 +139,8 @@ void __unionfs_check_dentry(const struct dentry *dentry,
   dend = dbend(dentry);
   BUG_ON(dstart  dend);
  
 - if ((dstart == -1  dend != -1) ||
 - (dstart != -1  dend == -1)) {
 + if (unlikely((dstart == -1  dend != -1) ||
 +  (dstart != -1  dend == -1))) {

[...]

the same here

 @@ -223,30 +224,30 @@ void __unionfs_check_dentry(const struct dentry *dentry,
   istart = ibstart(inode);
   iend = ibend(inode);
   BUG_ON(istart  iend);
 - if ((istart == -1  iend != -1) ||
 - (istart != -1  iend == -1)) {
 + if (unlikely((istart == -1  iend != -1) ||
 +  (istart != -1  iend == -1))) {

and here

[...]

 @@ -350,30 +354,30 @@ void __unionfs_check_file(const struct file *file,
   fend = fbend(file);
   BUG_ON(fstart  fend);
  
 - if ((fstart == -1  fend != -1) ||
 - (fstart != -1  fend == -1)) {
 + if (unlikely((fstart == -1  fend != -1) ||
 +  (fstart != -1  fend == -1))) {

and here

[...]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/25] Unionfs: add un/likely conditionals on debug ops

2007-09-25 Thread Erez Zadok
Signed-off-by: Erez Zadok <[EMAIL PROTECTED]>
---
 fs/unionfs/debug.c |  108 +++
 1 files changed, 57 insertions(+), 51 deletions(-)

diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index 9546a41..09b52ce 100644
--- a/fs/unionfs/debug.c
+++ b/fs/unionfs/debug.c
@@ -56,19 +56,19 @@ void __unionfs_check_inode(const struct inode *inode,
sb = inode->i_sb;
istart = ibstart(inode);
iend = ibend(inode);
-   if (istart > iend) {
+   if (unlikely(istart > iend)) {
PRINT_CALLER(fname, fxn, line);
printk(" Ci0: inode=%p istart/end=%d:%d\n",
   inode, istart, iend);
}
-   if ((istart == -1 && iend != -1) ||
-   (istart != -1 && iend == -1)) {
+   if (unlikely((istart == -1 && iend != -1) ||
+(istart != -1 && iend == -1))) {
PRINT_CALLER(fname, fxn, line);
printk(" Ci1: inode=%p istart/end=%d:%d\n",
   inode, istart, iend);
}
if (!S_ISDIR(inode->i_mode)) {
-   if (iend != istart) {
+   if (unlikely(iend != istart)) {
PRINT_CALLER(fname, fxn, line);
printk(" Ci2: inode=%p istart=%d iend=%d\n",
   inode, istart, iend);
@@ -76,24 +76,24 @@ void __unionfs_check_inode(const struct inode *inode,
}
 
for (bindex = sbstart(sb); bindex < sbmax(sb); bindex++) {
-   if (!UNIONFS_I(inode)) {
+   if (unlikely(!UNIONFS_I(inode))) {
PRINT_CALLER(fname, fxn, line);
printk(" Ci3: no inode_info %p\n", inode);
return;
}
-   if (!UNIONFS_I(inode)->lower_inodes) {
+   if (unlikely(!UNIONFS_I(inode)->lower_inodes)) {
PRINT_CALLER(fname, fxn, line);
printk(" Ci4: no lower_inodes %p\n", inode);
return;
}
lower_inode = unionfs_lower_inode_idx(inode, bindex);
if (lower_inode) {
-   if (bindex < istart || bindex > iend) {
+   if (unlikely(bindex < istart || bindex > iend)) {
PRINT_CALLER(fname, fxn, line);
printk(" Ci5: inode/linode=%p:%p bindex=%d "
   "istart/end=%d:%d\n", inode,
   lower_inode, bindex, istart, iend);
-   } else if (lower_inode == POISONED_PTR) {
+   } else if (unlikely(lower_inode == POISONED_PTR)) {
/* freed inode! */
PRINT_CALLER(fname, fxn, line);
printk(" Ci6: inode/linode=%p:%p bindex=%d "
@@ -107,8 +107,9 @@ void __unionfs_check_inode(const struct inode *inode,
 * b/t start/end, but NOT if at the
 * start/end range.
 */
-   if (!(S_ISDIR(inode->i_mode) &&
- bindex > istart && bindex < iend)) {
+   if (unlikely(!(S_ISDIR(inode->i_mode) &&
+  bindex > istart &&
+  bindex < iend))) {
PRINT_CALLER(fname, fxn, line);
printk(" Ci7: inode/linode=%p:%p "
   "bindex=%d istart/end=%d:%d\n",
@@ -138,8 +139,8 @@ void __unionfs_check_dentry(const struct dentry *dentry,
dend = dbend(dentry);
BUG_ON(dstart > dend);
 
-   if ((dstart == -1 && dend != -1) ||
-   (dstart != -1 && dend == -1)) {
+   if (unlikely((dstart == -1 && dend != -1) ||
+(dstart != -1 && dend == -1))) {
PRINT_CALLER(fname, fxn, line);
printk(" CD0: dentry=%p dstart/end=%d:%d\n",
   dentry, dstart, dend);
@@ -151,7 +152,7 @@ void __unionfs_check_dentry(const struct dentry *dentry,
for (bindex = sbstart(sb); bindex < sbmax(sb); bindex++) {
lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
if (lower_dentry) {
-   if (bindex < dstart || bindex > dend) {
+   if (unlikely(bindex < dstart || bindex > dend)) {
PRINT_CALLER(fname, fxn, line);
printk(" CD1: dentry/lower=%p:%p(%p) "
   "bindex=%d dstart/end=%d:%d\n",
@@ -169,10 +170,10 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 * however, if this is a NULL dentry or a

[PATCH 11/25] Unionfs: add un/likely conditionals on debug ops

2007-09-25 Thread Erez Zadok
Signed-off-by: Erez Zadok [EMAIL PROTECTED]
---
 fs/unionfs/debug.c |  108 +++
 1 files changed, 57 insertions(+), 51 deletions(-)

diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index 9546a41..09b52ce 100644
--- a/fs/unionfs/debug.c
+++ b/fs/unionfs/debug.c
@@ -56,19 +56,19 @@ void __unionfs_check_inode(const struct inode *inode,
sb = inode-i_sb;
istart = ibstart(inode);
iend = ibend(inode);
-   if (istart  iend) {
+   if (unlikely(istart  iend)) {
PRINT_CALLER(fname, fxn, line);
printk( Ci0: inode=%p istart/end=%d:%d\n,
   inode, istart, iend);
}
-   if ((istart == -1  iend != -1) ||
-   (istart != -1  iend == -1)) {
+   if (unlikely((istart == -1  iend != -1) ||
+(istart != -1  iend == -1))) {
PRINT_CALLER(fname, fxn, line);
printk( Ci1: inode=%p istart/end=%d:%d\n,
   inode, istart, iend);
}
if (!S_ISDIR(inode-i_mode)) {
-   if (iend != istart) {
+   if (unlikely(iend != istart)) {
PRINT_CALLER(fname, fxn, line);
printk( Ci2: inode=%p istart=%d iend=%d\n,
   inode, istart, iend);
@@ -76,24 +76,24 @@ void __unionfs_check_inode(const struct inode *inode,
}
 
for (bindex = sbstart(sb); bindex  sbmax(sb); bindex++) {
-   if (!UNIONFS_I(inode)) {
+   if (unlikely(!UNIONFS_I(inode))) {
PRINT_CALLER(fname, fxn, line);
printk( Ci3: no inode_info %p\n, inode);
return;
}
-   if (!UNIONFS_I(inode)-lower_inodes) {
+   if (unlikely(!UNIONFS_I(inode)-lower_inodes)) {
PRINT_CALLER(fname, fxn, line);
printk( Ci4: no lower_inodes %p\n, inode);
return;
}
lower_inode = unionfs_lower_inode_idx(inode, bindex);
if (lower_inode) {
-   if (bindex  istart || bindex  iend) {
+   if (unlikely(bindex  istart || bindex  iend)) {
PRINT_CALLER(fname, fxn, line);
printk( Ci5: inode/linode=%p:%p bindex=%d 
   istart/end=%d:%d\n, inode,
   lower_inode, bindex, istart, iend);
-   } else if (lower_inode == POISONED_PTR) {
+   } else if (unlikely(lower_inode == POISONED_PTR)) {
/* freed inode! */
PRINT_CALLER(fname, fxn, line);
printk( Ci6: inode/linode=%p:%p bindex=%d 
@@ -107,8 +107,9 @@ void __unionfs_check_inode(const struct inode *inode,
 * b/t start/end, but NOT if at the
 * start/end range.
 */
-   if (!(S_ISDIR(inode-i_mode) 
- bindex  istart  bindex  iend)) {
+   if (unlikely(!(S_ISDIR(inode-i_mode) 
+  bindex  istart 
+  bindex  iend))) {
PRINT_CALLER(fname, fxn, line);
printk( Ci7: inode/linode=%p:%p 
   bindex=%d istart/end=%d:%d\n,
@@ -138,8 +139,8 @@ void __unionfs_check_dentry(const struct dentry *dentry,
dend = dbend(dentry);
BUG_ON(dstart  dend);
 
-   if ((dstart == -1  dend != -1) ||
-   (dstart != -1  dend == -1)) {
+   if (unlikely((dstart == -1  dend != -1) ||
+(dstart != -1  dend == -1))) {
PRINT_CALLER(fname, fxn, line);
printk( CD0: dentry=%p dstart/end=%d:%d\n,
   dentry, dstart, dend);
@@ -151,7 +152,7 @@ void __unionfs_check_dentry(const struct dentry *dentry,
for (bindex = sbstart(sb); bindex  sbmax(sb); bindex++) {
lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
if (lower_dentry) {
-   if (bindex  dstart || bindex  dend) {
+   if (unlikely(bindex  dstart || bindex  dend)) {
PRINT_CALLER(fname, fxn, line);
printk( CD1: dentry/lower=%p:%p(%p) 
   bindex=%d dstart/end=%d:%d\n,
@@ -169,10 +170,10 @@ void __unionfs_check_dentry(const struct dentry *dentry,
 * however, if this is a NULL dentry or a
 * deleted dentry.
 */
-